Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grunt watcher on the .less files #2274

Merged
merged 5 commits into from Apr 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions client/README.md
Expand Up @@ -91,13 +91,15 @@ Grunt can also do an automatic, partial rebuild of any files you change *as you

1. opening a new terminal session
2. `cd client`
3. `grunt watch`
3. Watch with:
1. `grunt watch` to watch the *scripts/* folder
2. `grunt watch-style` to watch the *style/* folder

This starts a new grunt watch process that will monitor the files in `client/galaxy/scripts` for changes and copy and
pack them when they change.
This starts a new grunt watch process that will monitor the files, in the corresponding folder, for changes and copy and
rebuild them when they change.

You can stop the `grunt watch` task by pressing `Ctrl+C`. Note: you should also be able to background that task if you
prefer.
You can stop the watch task by pressing `Ctrl+C`. Note: you should also be able to background that task
if you prefer.


Using a Locally Installed Version of Grunt
Expand Down
17 changes: 16 additions & 1 deletion client/grunt-tasks/style.js
Expand Up @@ -75,15 +75,30 @@ module.exports = function( grunt ){
]
});


// -------------------------------------------------------------------------- watch & rebuild less files
// use 'grunt watch-style' (from a new tab in your terminal) to have grunt re-copy changed files automatically
grunt.config( 'watch', {
watch: {
// watch for changes in the src dir
files: [ lessPath + '/**' ],
tasks: ['check-modules', 'sprite', 'less-site-config', 'less', 'clean'],
options: {
spawn: false
}
}
});

grunt.loadNpmTasks( 'grunt-contrib-less' );
grunt.loadNpmTasks( 'grunt-spritesmith' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );

grunt.loadNpmTasks( 'grunt-contrib-watch' );

// Write theme variable for less
grunt.registerTask( 'less-site-config', 'Write site configuration for less', function() {
grunt.file.write( fmt( '%s/tmp-site-config.less', lessPath ), fmt( "@theme-name: %s;", theme ) );
});

grunt.registerTask( 'watch-style', [ 'watch' ] );
grunt.registerTask( 'style', [ 'check-modules', 'sprite', 'less-site-config', 'less', 'clean' ] );
};