输入:
gulp.js
var gulp = require('gulp');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('less', function() {
return gulp.src('src/less/style.less')
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/css'))
});
的package.json
{
"devDependencies": {
"gulp": "~3",
"gulp-less": "~1.1.10"
},
"dependencies": {
"gulp-sourcemaps": "^2.6.4"
}
}
src / less / style.less只有很多导入,任何样式。
gulp生成较少的地图文件和/ *#sourceMappingURL = style.css.map * /在文件的末尾存在,但我没有看到并链接到Crome开发工具中的实际较少的文件和地图文件的内容与Grunt生成的文件内容不同:
{"version":3,"names":[],"mappings":"","sources":["style.less"],"sourcesContent":["// MaxA styles\r\n@import (reference) 'base/_mixins';\r\n@import (reference) 'base/_variables';\r\n@import \"layout/_base.less\";\r\n\r\n// Magento\r\n@import \"magento\";\r\n//font\r\n@import \"font\";\r\n// Reset\r\n@import \"normalize\";\r\n@import \"print\";\r\n// Core CSS\r\n@import \"scaffolding\";\r\n@import .............................
有什么想法吗?
感谢。