我无法加载样式来从scss查看,下面是gulp.js,
//编译并自动添加样式表
gulp.task('styles', function () {
return gulp.src([
'Content/styles/**/*.scss',
'Content/styles/**/*.css'
])
.pipe($.newer('Content/styles'))
//.pipe($.newer('.tmp/styles'))
.pipe($.sourcemaps.init())
.pipe($.sass({
precision: 10
}).on('error', $.sass.logError))
.pipe($.autoprefixer({ browsers: AUTOPREFIXER_BROWSERS }))
.pipe(gulp.dest('Content/styles'))
//.pipe(gulp.dest('.tmp/styles'))
// Concatenate And Minify Styles
.pipe($.if('*.css', $.cssnano()))
.pipe($.size({ title: 'styles' }))
.pipe($.sourcemaps.write('./'))
.pipe(gulp.dest('Content'));
});
答案 0 :(得分:0)
假设Content是您的目录,您可以使用相对路径,如: -
gulp.task('styles', function () {
return gulp.src([
'./Content/styles/**/*.scss',
'./Content/styles/**/*.css'
])
.pipe($.newer('./Content/styles'))
//.pipe($.newer('.tmp/styles'))
.pipe($.sourcemaps.init())
.pipe($.sass({
precision: 10
}).on('error', $.sass.logError))
.pipe($.autoprefixer({ browsers: AUTOPREFIXER_BROWSERS }))
.pipe(gulp.dest('./Content/styles'))
//.pipe(gulp.dest('.tmp/styles'))
// Concatenate And Minify Styles
.pipe($.if('*.css', $.cssnano()))
.pipe($.size({ title: 'styles' }))
.pipe($.sourcemaps.write('./'))
.pipe(gulp.dest('./Content'));
});