Monday, 15 July 2013

gruntjs - Import another gruntjsfile into a gruntjsfile along with the tasks? -



gruntjs - Import another gruntjsfile into a gruntjsfile along with the tasks? -

i have gruntjsfile.js in root. have gruntjsfiles.js in subfolders of root. can import tasks gruntfiles subfolder main gruntjsfile in root , vice versa?

i separated tasks different files create clean, @ root need execute tasks different subroot gruntfiles.

can import('test/gruntjsfile') , tasks? or familiar?

directory

root (gruntfile.coffee dev root (gruntfile.coffee) prod root (gruntfile.coffee)

so want tasks dev root gruntfile , utilize them in root gruntfile.

//root gruntfile.coffee module.exports = (grunt) -> require('load-grunt-tasks')(grunt) grunt.task.loadtasks('./devroot/') grunt.initconfig pkg: grunt.file.readjson('package.json') grunt.registertask 'test', ['watch:tests'] //dev root (gruntjs) module.exports = (grunt) -> require('load-grunt-tasks')(grunt) grunt.initconfig pkg: grunt.file.readjson('package.json') coffee: engine: compile: expand : true cwd: 'theme/configurator/src/' src:['*.coffee'] dest: 'theme/configurator/src/' ext: '.js' tests: compile: expand : true cwd: 'drupal/unit_tests/test_cases/coffee/' src:['*.coffee'] dest: 'unit_tests/test_cases/js/' ext: '.js' jshint: options: asi: true eqnull: true sub: true browser: false phantom: true eqeqeq: true files: src: ['theme/configurator/src/*.js'] uglify: jsfiles: options: compress:{} beautify: true report: 'min' sourcemap: false sourcemapincludesources: false exportall: false files: [ expand: true, cwd: 'drupal/theme/configurator/src/', src:'*.js', dest:'drupal/theme/configurator/src/'] watch: tests: options: livereload: true forever: true atbegin: false testcoffeefiles: files: ['unit_tests/test_cases/coffee/*'] tasks: ['newer:coffee:tests'] enginefiles: files: ['theme/configurator/src/*.coffee'] tasks: ['newer:coffee:engine']

you can load them path

grunt.task.loadtasks(taskspath)

the finish reference here.

if want can add together them programmatically searching in folder hierarchy below current directory.

you execute grunt in task.

another alternative utilize grunt-run-grunt 1 option,grunt-grunt another.

gruntjs

No comments:

Post a Comment