node.js - Grunt cwd option issue -


i trying configure grunt-svg-sprite plugin in project , per documentation here http://gruntjs.com/configuring-tasks:

cwd src matches relative (but don't include) path.

src pattern(s) match, relative cwd.

and per https://www.npmjs.com/package/grunt-svg-sprite

however, path/to/assets become part of shape ids, want add working directory in cases:

your_target: {     expand      : true,     cwd         : 'path/to/assets',     src         : ['**/*.svg'],     dest        : 'path/to/css/dir',     options     : {         // target-specific options      } }, 

now, grunt file has section:

    svg_sprites: {         options: {          },         cw_sprites: {             expand: true,             cwd: 'public/assets/dist/svgs/',             src: ['**/*.svg'],             dest: 'public/assets/stylesheets/svg-sprites',             options: {                 shape : {                     dimension: {                         maxwidth: 32,                         maxheight: 32,                     },                     spacing: {                         padding:0,                     }                  },                 mode: {                     css : {                         render: {                             css: true                         },                         example:true                     },                     less: true,                 }             }           }     }, 

when run above task --verbose option, see following in output:

.... reading public/assets/dist/svgs/uncollapsed-triangle.svg...ok reading public/assets/fonts/glyphicons-halflings-regular.svg...ok reading public/assets/fonts/myraid-pro/myriadpro-regular.svg...ok warning: cannot read property 'replace' of undefined use --force continue. 

as per log above, trying read other directories outside cwd path public/assets/dist/svgs. in fact, goes on read root directory of project containing bower_components etc. , scans entire project root.

i thought using cwd option src option restrict sub-directories of 'cwd' or directories relative 'cwd'. why other directories being scanned?

am missing something? thank help.

okay, think figured out. there 2 projects similar names:

  1. grunt-svg-sprite (https://www.npmjs.com/package/grunt-svg-sprite) and
  2. grunt-svg-sprites (https://www.npmjs.com/package/grunt-svg-sprites)

i wanted use first project installed second 1 mistake!!!!! wouldn't have worked :-)

i removed erroneous module (2) , installed first 1 - works charm. makes me wonder if naming convention needs thinking npm modules.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -