node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



Optimize tvs files utilizing "uglify-js", "clean-css" and "html-minifier", resolve all the resource paths referred by the files and output files ready to deploy

Getting Started

This plugin requires Grunt ~0.4.2

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-dolphin-optimizer --save-dev

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


The "dolphin-optimizer" task


In your project's Gruntfile, add a section named dolphin-optimizer to the data object passed into grunt.initConfig().

  dolphin-optimizer: {
    options: {
      // Task-specific options go here. 
    your_target: {
      // Target-specific file lists and/or options go here. 



Type: String Default value: src

A string value that is used to designate src directory path.


Type: String Default value: build

A string value that is used to designate output directory path.


Type: String|Boolean Default value: css

'css' stands for only embed stylesheets; 'js' stands for only embed js code; true stands for embed both js code and stylesheets; false do not embed either; this setting is overwritten by the inline data-how="xxx" attribute.


Type: Object Default value: { js: true, css: true, html:{ removeComments: true } }

Set 'uglify-js','clean-css' and 'html-minifier' options respectively; true means use default options of each minifiers ### Usage Examples

Default Options

  dolphin-optimizer: {
    options: {
      srcPath: 'src',
      buildPath: 'build',
        //use 'uglify-js' 
        js: true,
        //use 'clean-css' 
        css: true,
        //use 'html-minifier' 
          removeComments: true


In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

0.1.5 add md5 tag to url resources 0.1.4 fix regex for css link node 0.1.3 support plugin loader system