使用Grunt手表和SASS错误
我正在尝试在Windows上使用SASS,但是每次出现错误
Waiting... OK >> File "scss\main.scss" changed. Running "sass:dist" (sass) task Error: Error generating source map: couldn't determine public URL for the source stylesheet. No filename is available so there's nothing for the source map to link to. on line of standard input Use --trace for backtrace. Warning: Error: Error generating source map: couldn't determine public URL for the source stylesheet. No filename is available so there's nothing for the source map to link to. on line of standard input Use --trace for backtrace. Use --force to continue. Aborted due to warnings. Completed in 0.769s at Wed May 13 2015 10:55:24 GMT+0200 (W. Europe Daylight Time)
我在这里发现了一个类似的问题 ,但是这对我没有用
我的package.json:
{ "name": "Test", "version": "1.0.0", "description": "Test thingy", "author": "Me", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-sass": "~0.3.0", "grunt-contrib-watch": "~0.4.4" } }
我的Gruntfile.js
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), sass: { dist: { options: { style: 'compressed' }, files: { 'css/style.css' : 'sass/style.scss' } } }, watch: { css: { files: '**/*.scss', tasks: ['sass'], options: { spawn: false } } }, }); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default',['watch']); }
软件版本:
grunt-cli v0.1.13
grunt v0.4.5
Sass 3.4.13(select性史蒂夫)
ruby2.2.2p95(2015-04-13修改50295)[x64-mingw32]
指南针1.0.3(北极星)
npm 2.7.4
节点v0.12.2
我试过更新所有的软件包,甚至重新安装了所有的组件,但没有帮助。 谁能帮我?
尝试禁用sourcemap,看看它是否工作。
module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), sass: { dist: { options: { style: 'compressed', sourcemap: 'none' }, files: { 'css/style.css' : 'sass/style.scss' } } }, watch: { css: { files: '**/*.scss', tasks: ['sass'], options: { spawn: false } } }, }); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default',['watch']); }