javascript - Grunt Watch no running task for JS or CSS -
I'm not sure why my harsh clock is not running for JS or CSS configuration
< P> My grunt file is in the 'Tools' folder The project folder structure looks like this: -index.html -js -css -tools - package.json --node module --gruntfile .js
Here is my CSS folder structure:
- Css - SRC --- styles. CSS --- third party ---- bootstrap.css
This is my JS folder structure:
-js --src --- app .js --- third-party ---- jquery.js
This is my package. Jason
{"name": "my-project-name", "version": "0.1.0", "devDependencies": {"suffocation": "~ 0.4.5", "Grant-Contrib-CSCM": "^ 0.10.0", "Grant-Contrib-GSINitt": "~ 0.10.0", "Grant-Contrib-Uglif": "~ 0.5.0", "Grant-Contrib- Watch ":" ^ 0.6.1 "," Matchdeep ":" ^ 0.3.0 "}}
This is my grunted file, this is a clock work that does not seem to work :
module.exports = function (grunt) {// loads the required tasks for this grunt file ('Matchdep') is required FilterDev ('grunt-yo Dan - * ') foreach (grunt.loadNpmTasks).;. // Project Configuration grunt.initConfig ({// Load package.json file so that the project name and version number is given access to .pkg: grunt.file.readJSON ('package.json'), // if content for grantfile Can easily change the path to our environment // Note: / / 'with BASE_PATH:' ../ ', JS_SOURCE_PATH:' ../js/src/ ', JS_BUILD_PATH:' ../js/build/ ' , CSS_SOURCE_PATH: '../css/src/', CSS_BUILD_PATH: '../css/build/', ugly: {files: {extension: true, CWD: '<% = JS_SOURCE_PATH% & gt; ', Src:'. ** / * JS, destination: '<% = JS_BUILD_PATH% & gt;', level: false,}}, JSHint: {VIC SP: {jshintrc: '& lt;% = JS_SOURCE_PATH% & gt; .jshintrc', force: true}, all: ['lt;% = JS_SOURCE_PATH% & gt; ** / * .js','! & Lt;% = JS_SOURCE_PATH% & gt; Third-party / ** / * .js']}, csmin: {options: {keepBreaks: true, report: 'gzip'}, minify: {extension: true, cwd: '& Lt;% = CSS_SOURCE_PATH% & gt;', src: '** / * .css', dest: '<% = CSS_BUILD_PATH%>'}}, clock: {option: {livereload: true Is, nospawn: true}, js: {files: ['& lt;% = JS_SOURCE_PATH% & gt; ** / * js. ' ], Functions: ['jshint']}, css: {files: ['& lt;% = CSS_SOURCE_PATH% & gt; ** / * .css '], Action: [' cssmin ']}, html: {files: [' & lt;% = BASE_PATH% & gt; *. Html]]}}}); Grunt.registerTask ('default', ['jshint', 'uglify', 'cssmin']); Grunt.registerTask ('doit', ['uglify', 'cssmin']); Grunt.registerTask ('css', ['cssmin']); Grunt.registerTask ('hint', ['jshint']); };
Edit: When I run 'Billing Clock - Verbose', output is
Working in progress: "Clock" work is in progress Wait ... Confirm property clock is present in the config ... OK, Verifying property watch.js.files exists in the config ... OK, verify property watch.css.files Valid in config It is ... ok, verify property.files.files exists in the config. Ok live reload started on server port: see 35729./js/src/app.js for changes for changes ../js/src/third-party for changes to see ../js/src/third -party / jquery.js See ../css/src/styles.css for changes to see. See ../css/src/third-party for changes ../css/src/third-party/bootstrap.css for changes. See ../index.html for changes. For changes .. / cs view for changes .. / js are looking for changes
I think the problem is the path and gruntfile position.
BASE_PATH: You may enter this amount '../', JS_SOURCE_PATH: '../js/src/', JS_BUILD_PATH: '../js/build/ ', CSS_SOURCE_PATH:' ../css/src/ ', CSS_BUILD_PATH:' ..//ssss/build/ ',
It seems that the gruntfile is not in the root directory, but one In the folder.
GruntFile (and package.jsan, node_module) must be in the root of the project to work well.
If you want to change your pat, you can set two parameters
code> BASE_PATH: ', JS_SOURCE_PATH:' js / src / ', JS_BUILD_PATH:' js / creation / ', CSS_SOURCE_PATH : 'CSS / src /', CSS_BUILD_PATH: 'CSS / creation /',
after launching from your console:
gr unt watch < / Code>
Comments
Post a Comment