<tfoot id='3TPPa'></tfoot>

      <i id='3TPPa'><tr id='3TPPa'><dt id='3TPPa'><q id='3TPPa'><span id='3TPPa'><b id='3TPPa'><form id='3TPPa'><ins id='3TPPa'></ins><ul id='3TPPa'></ul><sub id='3TPPa'></sub></form><legend id='3TPPa'></legend><bdo id='3TPPa'><pre id='3TPPa'><center id='3TPPa'></center></pre></bdo></b><th id='3TPPa'></th></span></q></dt></tr></i><div id='3TPPa'><tfoot id='3TPPa'></tfoot><dl id='3TPPa'><fieldset id='3TPPa'></fieldset></dl></div>
      1. <small id='3TPPa'></small><noframes id='3TPPa'>

          <bdo id='3TPPa'></bdo><ul id='3TPPa'></ul>
      2. <legend id='3TPPa'><style id='3TPPa'><dir id='3TPPa'><q id='3TPPa'></q></dir></style></legend>

        缩进的 Sass 语法不适用于 node-sass 和 gulp-sass

        时间:2023-05-28
          <tbody id='5FY4s'></tbody>

        <legend id='5FY4s'><style id='5FY4s'><dir id='5FY4s'><q id='5FY4s'></q></dir></style></legend>
        <i id='5FY4s'><tr id='5FY4s'><dt id='5FY4s'><q id='5FY4s'><span id='5FY4s'><b id='5FY4s'><form id='5FY4s'><ins id='5FY4s'></ins><ul id='5FY4s'></ul><sub id='5FY4s'></sub></form><legend id='5FY4s'></legend><bdo id='5FY4s'><pre id='5FY4s'><center id='5FY4s'></center></pre></bdo></b><th id='5FY4s'></th></span></q></dt></tr></i><div id='5FY4s'><tfoot id='5FY4s'></tfoot><dl id='5FY4s'><fieldset id='5FY4s'></fieldset></dl></div>
        • <bdo id='5FY4s'></bdo><ul id='5FY4s'></ul>

            • <small id='5FY4s'></small><noframes id='5FY4s'>

              <tfoot id='5FY4s'></tfoot>

                1. 本文介绍了缩进的 Sass 语法不适用于 node-sass 和 gulp-sass的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  Libsass 2.0 为 libsass 用户带来了缩进语法,但到目前为止,我还无法使其与 node-sassgulp-sass 一起使用.我有所有最新版本:

                  node-sass:0.93
                  gulp-sass:0.7.2
                  吞咽:3.8.2

                  此设置使用括号语法编译 .scss 文件甚至 .sass 文件,但不会编译缩进语法.有人用 node-sass 和 gulp 成功编译了缩进语法吗?

                  我的 gulpfile.js

                  var gulp = require('gulp');var sass = require('gulp-sass');gulp.task('sass', function() {返回 gulp.src('./sites/all/themes/nsfvb/sass/screen.sass').pipe(萨斯({includePaths: require('node-neat').includePaths,errLogToConsole: 真})).pipe(gulp.dest('./sites/all/themes/nsfvb/css'));});gulp.task('watch', function() {gulp.watch('./sites/all/themes/nsfvb/sass/*.sass', ['sass']);});gulp.task('default', ['sass', 'watch']);


                  运行默认任务时出错

                  错误:无效的顶级表达式

                  解决方案

                  更新答案:

                  <块引用>

                  如果您想使用缩进语法 (.sass) 作为顶级文件,请使用 sass({indentedSyntax: true}).

                  sass({indentedSyntax: true})

                  过时的答案

                  在这里找到答案:https://github.com/dlmanning/gulp-sass/issues/55#issuecomment-50882250

                  <块引用>

                  使用默认设置编译 sass 文件不起作用.但是,有一种解决方法.如果您通过 sourceComments: 'normal' 作为参数编译工作.原因是有一个奇怪的条件改变了文件的处理方式:https://github.com/dlmanning/gulp-sass/blob/master/index.js#L23-L27

                  此处的代码示例:https://github.com/chrisdl/gulp-libsass-example/blob/master/gulpfile.js

                  var gulp = require('gulp');var sass = require('gulp-sass');//在终端中使用> gulp sass"运行.gulp.task('sass', function () {gulp.src('./sass/main.sass').pipe(sass({sourceComments: 'normal'})).pipe(gulp.dest('./css'));});

                  通知

                  如果您在使用此代码段时遇到问题,请查看以下引用和问题.

                  <块引用>

                  使用此解决方法将导致 gulp 管道中早期文件内容的任何更改(例如早期插件)被丢弃 - JMM

                  https://github.com/dlmanning/gulp-sass/issues/158

                  Libsass 2.0 brought the indented syntax to libsass users, but so far I've been unable to make it work with node-sass and gulp-sass. I have all of the latest versions:

                  node-sass: 0.93
                  gulp-sass: 0.7.2
                  gulp: 3.8.2

                  This setup compiles .scss files and even .sass files using the bracket syntax but it will not compile the indented syntax. Has anyone successfully compiled the indented syntax with node-sass and gulp?

                  My gulpfile.js

                  var gulp = require('gulp');
                  var sass = require('gulp-sass');
                  
                  gulp.task('sass', function() {
                      return gulp.src('./sites/all/themes/nsfvb/sass/screen.sass')
                          .pipe(sass({
                              includePaths: require('node-neat').includePaths,
                              errLogToConsole: true
                          }
                          ))
                          .pipe(gulp.dest('./sites/all/themes/nsfvb/css'));
                  });
                  
                  gulp.task('watch', function() {
                      gulp.watch('./sites/all/themes/nsfvb/sass/*.sass', ['sass']);
                  });
                  
                  gulp.task('default', ['sass', 'watch']);
                  


                  Error when running the default task

                  error: invalid top-level expression

                  解决方案

                  Updated answer:

                  If you want to use the indented syntax (.sass) as the top level file, use sass({indentedSyntax: true}).

                  sass({indentedSyntax: true})
                  

                  Outdated answer

                  Answer found here: https://github.com/dlmanning/gulp-sass/issues/55#issuecomment-50882250

                  With default settings compiling sass files doesn't work. However there is a workaround. If you pass sourceComments: 'normal' as parameter the compilation work. The reason for this is that there is a strange condition which change how file are handled: https://github.com/dlmanning/gulp-sass/blob/master/index.js#L23-L27

                  Code example found here: https://github.com/chrisdl/gulp-libsass-example/blob/master/gulpfile.js

                  var gulp = require('gulp');
                  var sass = require('gulp-sass');
                  
                  // Run with "> gulp sass" in terminal.
                  gulp.task('sass', function () {
                  gulp.src('./sass/main.sass')
                      .pipe(sass({sourceComments: 'normal'}))
                      .pipe(gulp.dest('./css'));
                  });
                  

                  Notice

                  If you run into issues using this snippet take a look at the following quote and issue.

                  Using this workaround will result in any changes to the file content from earlier in the gulp pipeline (e.g. earlier plugins) being discarded - JMM

                  https://github.com/dlmanning/gulp-sass/issues/158

                  这篇关于缩进的 Sass 语法不适用于 node-sass 和 gulp-sass的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:gulp.dest 没有创建目标文件夹 下一篇:aspnet core如何在deploy上构建webpack

                  相关文章

                  最新文章

                    <legend id='cos8l'><style id='cos8l'><dir id='cos8l'><q id='cos8l'></q></dir></style></legend>

                    <small id='cos8l'></small><noframes id='cos8l'>

                    1. <tfoot id='cos8l'></tfoot>

                        <bdo id='cos8l'></bdo><ul id='cos8l'></ul>
                      <i id='cos8l'><tr id='cos8l'><dt id='cos8l'><q id='cos8l'><span id='cos8l'><b id='cos8l'><form id='cos8l'><ins id='cos8l'></ins><ul id='cos8l'></ul><sub id='cos8l'></sub></form><legend id='cos8l'></legend><bdo id='cos8l'><pre id='cos8l'><center id='cos8l'></center></pre></bdo></b><th id='cos8l'></th></span></q></dt></tr></i><div id='cos8l'><tfoot id='cos8l'></tfoot><dl id='cos8l'><fieldset id='cos8l'></fieldset></dl></div>