【发布时间】:2015-06-08 05:04:39
【问题描述】:
我正在为我手头的一个小项目创建以下 grunt 文件。但是,它会因以下消息而中止
Running "sass:dev" (sass) task
Warning: Arguments to path.join must be strings Use --force to continue.
我哪里做错了?谁能给我解释一下?
/*!
* XXX
* @author XXXXXX
*/
'use strict';
/**
* Grunt Module
*/
module.exports = function(grunt) {
// Grunt goodness goes here
/**
* Configuration
*/
grunt.initConfig({
/**
* Get package meta data
*/
pkg: grunt.file.readJSON('package.json'),
/**
* Set project object
*/
project: {
app: 'app',
assets: '<%= project.app %>/assets',
src: '<%= project.assets %>/src',
css: [
'<%= project.src %>/styles/*.scss'
],
js: [
'<%= project.src %>/scripts/*.js'
],
dist: '<%= project.assets %>/dist',
distcss: [
'<%= project.dist %>/styles/*.scss'
],
distjs: [
'<%= project.dist %>/scripts/*.js'
],
},
/**
* Project banner
*/
tag: {
banner: '/*!\n' +
' * <%= pkg.name %>\n' +
' * <%= pkg.title %>\n' +
' * <%= pkg.url %>\n' +
' * @author <%= pkg.author %>\n' +
' * @version <%= pkg.version %>\n' +
' * Copyright <%= pkg.copyright %>. <%= pkg.license %> licensed.\n' +
' */\n'
},
/**
* Sass
*/
sass: {
dev: {
options: {
style: 'expanded',
banner: '<%= tag.banner %>',
compass: true
},
files: {
'<%= project.css %>': '<%= project.distcss %>'
}
},
dist: {
options: {
style: 'compressed',
compass: true
},
files: {
'<%= project.css %>': '<%= project.distcss %>'
}
}
},
/**
* Watch
*/
watch: {
sass: {
files: '<%= project.src %>/styles/{,*/}*.{scss,sass}',
tasks: 'sass:dev'
}
},
// Uglify
uglify: {
options: {
banner: '/*! <%= pkg.name %> Version: <%= pkg.version %> Created on: <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/scripts/*.js',
dest: 'build/<%= pkg.name %>.min.js'
}
}
});
/**
* Load Grunt plugins
*/
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
/**
* Default task
* Run `grunt` on the command line
*/
grunt.registerTask('default', [
'sass:dev',
'watch'
]);
};
【问题讨论】:
标签: sass gruntjs grunt-contrib-watch