以下は私のGruntファイルです。コマンドが機能していないようで、その理由がわかりwatch:news
ません。
詳細モードで実行すると、すべての NPM モジュールが問題なくロードされ、watch:news
タスクが正常に実行されていることを確認できますが、変更が発生したことがわかりません。
おそらくタイプミスか、小さな/簡単に修正できる問題だと思いますが、見つけられませんか?
どんな助けでも大歓迎です!
module.exports = function (grunt) {
/*
Grunt installation:
-------------------
npm install -g grunt-cli
npm install -g grunt-init
npm init (creates a `package.json` file)
Project Dependencies:
---------------------
npm install grunt --save-dev
npm install grunt-contrib-watch --save-dev
npm install grunt-contrib-jshint --save-dev
npm install grunt-contrib-uglify --save-dev
npm install grunt-contrib-requirejs --save-dev
npm install grunt-contrib-sass --save-dev
npm install grunt-contrib-imagemin --save-dev
Example Usage:
--------------
grunt -v
grunt release -v
*/
// Project configuration.
grunt.initConfig({
// Store your Package file so you can reference its specific data whenever necessary
pkg: grunt.file.readJSON('package.json'),
dir: {
static: './tabloid/webapp/static/',
static_js: '<%= dir.static %>' + 'js/',
static_sass: '<%= dir.static %>' + 'sass/',
static_css: '<%= dir.static %>' + 'stylesheets/',
static_img: '<%= dir.static %>' + 'img/'
},
jshint: {
files: ['<%= dir.static %>**/*.js',
'!<%= dir.static_js %>jasmine/lib/**/*.js',
'!<%= dir.static_js %>build.js',
'!<%= dir.static_js %>compiled/**/*.js',
'!<%= dir.static_js %>locator/**/*.js',
'!<%= dir.static_js %>msie/**/*.js',
'!<%= dir.static_js %>vendor/**/*.js'],
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true,
multistr: true,
newcap: false,
globals: {
// AMD
module: true,
require: true,
requirejs: true,
define: true,
// Environments
console: true,
// General Purpose Libraries
$: true,
jQuery: true,
EventEmitter: true,
// Testing
sinon: true,
describe: true,
it: true,
expect: true,
beforeEach: true,
afterEach: true
}
}
},
requirejs: {
compile: {
options: {
baseUrl: '<%= dir.static_js %>',
paths: {
'jquery-1': 'vendor/jquery-1/jquery.min',
'jquery': 'vendor/jquery-2/jquery.min',
'domReady': 'vendor/require/domReady',
'translation': 'module/translations/news'
},
exclude: ['config', 'jquery' ],
name: 'define',
out: '<%= dir.static_js %>compiled/all.js',
fileExclusionRegExp: /^\.|node_modules|Gruntfile|\.md|package.json/
}
}
},
sass: {
dist: {
options: {
style: 'compressed',
require: ['<%= dir.static_sass %>helpers/url64.rb']
},
expand: true,
cwd: '<%= dir.static_sass %>',
src: ['*.scss', '!_*.scss'],
dest: '<%= dir.static_css %>',
ext: '.css'
},
dev: {
options: {
style: 'expanded',
debugInfo: true,
lineNumbers: true,
require: ['<%= dir.static_sass %>helpers/url64.rb']
},
expand: true,
cwd: '<%= dir.static_sass %>',
src: ['*.scss', '!_*.scss'],
dest: '<%= dir.static_css %>',
ext: '.css'
},
news: {
options: {
style: 'expanded',
debugInfo: true,
lineNumbers: true,
require: ['<%= dir.static_sass %>helpers/url64.rb']
},
expand: true,
cwd: '<%= dir.static_sass %>/services/news/',
src: ['*.scss'],
dest: '<%= dir.static_css %>/services/news/',
ext: '.css'
}
},
// `optimizationLevel` is only applied to PNG files (not JPG)
imagemin: {
png: {
options: {
optimizationLevel: 7
},
files: [
{
expand: true,
cwd: '<%= dir.static %>img/',
src: ['**/*.png'],
dest: '<%= dir.static %>img/',
ext: '.png'
}
]
},
jpg: {
options: {
progressive: true
},
files: [
{
expand: true,
cwd: '<%= dir.static %>img/',
src: ['**/*.jpg'],
dest: '<%= dir.static %>img/',
ext: '.jpg'
}
]
}
},
// Run: `grunt watch -v` from command line for this section to take effect
// The -v flag is for 'verbose' mode, this means you can see the Sass files being compiled along with other important information
watch: {
all: {
files: ['<%= jshint.files %>', '<%= sass.dev.src %>'],
tasks: ['default']
},
news: {
files: ['<%= sass.news.src %>'],
tasks: ['news']
}
}
});
// Load NPM Tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-imagemin');
// Default Task
grunt.registerTask('default', ['jshint', 'sass:dev']);
// News Task
grunt.registerTask('news', ['sass:news']);
// Release Task
grunt.registerTask('release', ['jshint', 'requirejs', 'sass:dist', 'imagemin']);
};