javascript - Put Grunt in a subdirectory -


is possible put grunt config files in sub directory of project? want keep things more organised.

e.g.

  • myproject/grunt/gruntfile.js

  • myproject/grunt/package.json

  • myproject/grunt/node_modules/

i'm having problems running commands gruntfile.js under configuration. can grunt handle looking parent directory? or maybe i'm doing wrong

sass: {     dev: {        files: {            "../style.css": "../scss/style.scss"        }     } } 

when run grunt seems shrug, not understanding want in parent directory…

source file "scss/style.scss" not found. 

yes, should possible, want use grunt.file.setbase method or --base command-line option make tasks work had put gruntfile in root of project. otherwise, run various issues tasks that, default, not write paths outside working directory. example, force option on grunt-contrib-clean plugin.

here example modifies sample gruntfile getting started page use method:

module.exports = function(grunt) {    // if put call setbase here, package.json ,   // loadnpmtasks paths wrong!!!    // project configuration.   grunt.initconfig({     pkg: grunt.file.readjson('package.json'),     uglify: {       options: {         banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'       },       build: {         src: 'src/<%= pkg.name %>.js',         dest: 'build/<%= pkg.name %>.min.js'       }     }   });    // load plugin provides "uglify" task.   grunt.loadnpmtasks('grunt-contrib-uglify');    // we've loaded package.json , node_modules set base path   // actual execution of tasks   grunt.file.setbase('../')    // default task(s).   grunt.registertask('default', ['uglify']);  }; 

i don't use sass, can't comment on whether might wrong task config, above works modification of getting started example.


Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -