Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-contrib-compress

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-contrib-compress

Compress files and folders.

  • 0.4.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43K
decreased by-1.92%
Maintainers
3
Weekly downloads
 
Created
Source

grunt-contrib-compress Build Status

Compress files and folders.

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-contrib-compress --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-contrib-compress');

This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade, but in case you can't please use v0.3.2.

Compress task

Run this task with the grunt compress command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Node Libraries Used: archiver (for zip/tar) zlib (for gzip).

Options

archive

Type: String

This is used to define where to output the archive. Each target can only have one output file.

mode

Type: String

This is used to define which mode to use, currently supports gzip, tar, tgz (tar gzip) and zip.

Automatically detected per dest:src pair, but can be overridden per target if desired.

level (zip only)

Type: Integer Default: 1

Sets the level of archive compression.

Currently, gzip compression related options are not supported due to deficiencies in node's zlib library.

pretty

Type: Boolean Default: false

Pretty print file sizes when logging.

Usage Examples

// make a zipfile
compress: {
  main: {
    options: {
      archive: 'archive.zip'
    },
    files: [
      {src: ['path/*'], dest: 'internal_folder/', filter: 'isFile'}, // includes files in path
      {src: ['path/**'], dest: 'internal_folder2/'}, // includes files in path and its subdirs
      {expand: true, cwd: 'path/', src: ['**'], dest: 'internal_folder3/'}, // makes all src relative to cwd
      {flatten: true, src: ['path/**'], dest: 'internal_folder4/', filter: 'isFile'} // flattens results to a single level
    ]
  }
}
// gzip assets 1-to-1 for production
compress: {
  main: {
    options: {
      mode: 'gzip'
    },
    expand: true,
    cwd: 'assets/',
    src: ['**/*'],
    dest: 'public/'
  }
}

Release History

  • 2013-03-19   v0.4.5   Update to archiver 0.4.1
  • 2013-03-18   v0.4.4   Fixes for Node.js v0.10. Explicitly call grunt.file methods with map and filter.
  • 2013-03-13   v0.4.3   Fix for gzip; continue iteration on returning early.
  • 2013-03-12   v0.4.2   Refactor task like other contrib tasks. Fix gzip of multiple files. Remove unused dependencies.
  • 2013-02-21   v0.4.1   Pretty print compressed sizes. Logging each addition to a compressed file now only happens in verbose mode.
  • 2013-02-14   v0.4.0   First official release for Grunt 0.4.0.
  • 2013-01-22   v0.4.0rc7   Updating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
  • 2013-01-13   v0.4.0rc5   Updating to work with grunt v0.4.0rc5. Conversion to grunt v0.4 conventions. Replace basePath with cwd.
  • 2012-10-11   v0.3.2   Rename grunt-contrib-lib dep to grunt-lib-contrib.
  • 2012-10-08   v0.3.1   Replace zipstream package with archiver.
  • 2012-09-23   v0.3.0   General cleanup. Options no longer accepted from global config key.
  • 2012-09-17   v0.2.2   Test refactoring. No valid source check. Automatic mode detection.
  • 2012-09-09   v0.2.0   Refactored from grunt-contrib into individual repo.

Task submitted by Chris Talkington

This file was generated on Wed Mar 20 2013 16:00:56.

Keywords

FAQs

Package last updated on 21 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc