jney / grunt-rework

use gruntjs to rework your css files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Publish new version

lazd opened this issue · comments

NPM version differs from github, and the new use syntax makes much more sense.

Is this why the current npm version doesn't work with the syntax as outlined in the readme? Because with version 0.1.0 (latest npm version), the use syntax as specified in the readme:

use: [
  rework_import
]

Returns null (as can be seen with the --verbose flag)

Running "rework:prod" (rework) task
Verifying property rework.prod exists in config...OK
Files: src/main.css -> dist/main.css
Options: toString={"compress":false}, use=[null]
Options: toString={"compress":false}, use=[null]
Reading src/main.css...OK
Writing dist/main.css...OK
File "dist/main.css" created.

and thus does not load any rework plugins. If this is because the docs and current npm version are different I would highly recommend updating the npm version as well.

Hmm, I'm using the syntax from the README without problems. Triple check your installed version by doing a npm install grunt-rework@0.1.0 and make sure rework_import variable refers to an instance of the plugin (returned by calling the plugin), not the plugin itself.

Here's a sample gruntfile.js that I just tested against 0.1.0:

module.exports = function(grunt) {
  grunt.loadNpmTasks('grunt-rework');

  var reworkPlugins = [
    require('rework-import')({
      path: [
        'source/css/',
        'node_modules/'
      ]
    }),
    require('rework-inherit')(),
    require('rework-vars')(),
    require('rework-calc')
  ];

  var reworkFiles = {
    'build/index.css': 'source/css/index.css',
  };

  grunt.initConfig({
    rework: {
      options: {
        use: reworkPlugins
      },
      dev: {
        files: reworkFiles,
        options: {
          toString: {
            sourcemap: true
          }
        }
      },
      prod: {
        files: reworkFiles,
        options: {
          toString: {
            compress: true
          }
        }
      }
    }
  });

  grunt.registerTask('prod', ['rework:prod']);
  grunt.registerTask('dev', ['rework:dev']);
};

Furthermore, it looks like a new version has been published and all is well with the cosmos, closing this.

Ah I see what I did wrong. I missed the variable declaration in the readme. Thanks for the help :)!