webstorm scss to wxss

前言

系统:windows系统
sass版本: 1.42.1 compiled with dart2js 2.14.2

第一步: 全局安装sass

// 使用淘宝镜像安装,确保安装成功
cnpm install -g sass
or
yarn add global  sass 

查看sass否安装成功:在控制台 输入sass --version,出现版本,表示安装成功

详情请查看官网:https://www.sass.hk/ 或者 https://www.runoob.com/sass/sass-install.html

第二步:webstorm设置scss 编译成wxss

新建一个fileWatchers,点击Apply,然后点ok

image.png

Arguments输入:

$FileName$:$FileNameWithoutExtension$.wxss --no-source-map

Output paths to refresh输入

$FileNameWithoutExtension$.wxss

第三步:验证

image.png

如需要生成map文件,Arguments输入:去掉--no-source-map

效果如下图所示:


image.png

补充

可以通过sass --help查看当前sass版本的命令

=== Input and Output ===================
    --[no-]stdin               Read the stylesheet from stdin.
    --[no-]indented            Use the indented syntax for input from stdin.
-I, --load-path=<PATH>         A path to use when resolving imports.
                               May be passed multiple times.
-s, --style=<NAME>             Output style.
                               [expanded (default), compressed]
    --[no-]charset             Emit a @charset or BOM for CSS with non-ASCII characters.
                               (defaults to on)
    --[no-]error-css           When an error occurs, emit a stylesheet describing it.
                               Defaults to true when compiling to a file.
    --update                   Only compile out-of-date stylesheets.

=== Source Maps ========================
    --[no-]source-map          Whether to generate source maps.
                               (defaults to on)
    --source-map-urls          How to link from source maps to source files.
                               [relative (default), absolute]
    --[no-]embed-sources       Embed source file contents in source maps.
    --[no-]embed-source-map    Embed source map contents in CSS.

=== Other ==============================
-w, --watch                    Watch stylesheets and recompile when they change.
    --[no-]poll                Manually check for changes rather than using a native watcher.
                               Only valid with --watch.
    --[no-]stop-on-error       Don't compile more files once an error is encountered.
-i, --interactive              Run an interactive SassScript shell.
-c, --[no-]color               Whether to use terminal colors for messages.
    --[no-]unicode             Whether to use Unicode characters for messages.
-q, --[no-]quiet               Don't print warnings.
    --[no-]quiet-deps          Don't print compiler warnings from dependencies.
                               Stylesheets imported through load paths count as dependencies.
    --[no-]verbose             Print all deprecation warnings even when they're repetitive.
    --[no-]trace               Print full Dart stack traces for exceptions.
-h, --help                     Print this usage information.
    --version                  Print the version of Dart Sass.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Sass官网:https://www.sass.hk/docs/[https://www.sass.hk/docs...
    是曹不是蔡阅读 712评论 0 0
  • 感谢原作者的辛苦整理原文章地址: 前端框架库汇总[https://www.jianshu.com/p/d8584f...
    JX灬君阅读 1,754评论 0 24
  • 废话少说,本文分四个部分,css、js、知识点一、知识点二、React(部分问题没有给出答案,后续更新) css面...
    666同学阅读 1,141评论 0 0
  • 16宿命:用概率思维提高你的胜算 以前的我是风险厌恶者,不喜欢去冒险,但是人生放弃了冒险,也就放弃了无数的可能。 ...
    yichen大刀阅读 6,122评论 0 4
  • 公元:2019年11月28日19时42分农历:二零一九年 十一月 初三日 戌时干支:己亥乙亥己巳甲戌当月节气:立冬...
    石放阅读 6,930评论 0 2