Problem
I am currently working on a project in which we have a parent web application (for example, an AngularJS application) and several Bower child modules (containing Javascript, SASS, images, etc.) that are included in the parent using Bower .
For example, the parent bower.json looks like this:
{
"name": "parent-app",
"version": "1.0.0",
"dependencies": {
"child-1-module": "1.0.0",
"child-2-module": "1.0.0"
}
}
When you install "bower install" on the parent module, the child modules will be installed on:
bower_components/child-1-module
bower_components/child-2-module
Then we use the 'bower link' for each of the child modules.
Then the parent channel bower link-1-module and bower link child-2-module for the parent to create local soft links, such as:
bower_components/child-1-module -> /some/where/else/child-1-module
bower_components/child-2-module -> /some/where/else/child-2-module
.
Grunt grunt-contrib-watch , Grunt , , .
Gruntfile.js, .js, "jshint", " " :
grunt.initConfig({
// Watches files for changes and runs tasks based on the changed files
watch: {
js: {
files: [
'scripts/{,*/}*.js',
],
tasks: ['newer:jshint:all'],
options: {
livereload: true
}
}
}
}
, , . , / .
1: bower_components
Gruntfile, .js bower_components, :
grunt.initConfig({
// Watches files for changes and runs tasks based on the changed files
watch: {
js: {
files: [
'scripts/**/*.js',
'bower_components/**/*.js'
],
tasks: ['newer:jshint:all'],
options: {
livereload: true
}
}
}
}
( .js), - EMFILE: (. ).
, , Grunt , :
'bower_components/child-1-module/**/*.js'
2:
Gruntfile.js , .
, "livereload", .
"Gruntfile.js" child-module-1
grunt.initConfig({
watch: {
js: {
files: ['scripts/**/*.js'],
tasks: ['livereloadEvent:js', 'newer:jshint:all']
}
}
}
grunt.registerTask('livereloadEvent', function() {
grunt.file.mkdir('livereload');
for(var i = 0; i < this.args.length; i++) {
grunt.file.write('livereload/livereload.'+ this.args[i], new Date());
}
});
:
'bower_components/**/livereload/livereload.js'
. , .
, .
...
? ?