webstorm入门5-sass、scss、less监听编译
来源:互联网 发布:初中网络教育 编辑:程序博客网 时间:2024/05/18 22:09
TOC
- sass、scss
- less
- 更多
在使用 webstorm 编辑器时,你不必写 gulp、grunt 配置文件来监听 css 预处理文件来实时编译,也不必安装其他 watch 插件,webstorm 自带就有了。
打开配置(Tools - File Watchers)就可以见到了,点击“+”号就可以新建监听配置了。
同时,在新建一个 sass、scss、less 文件之后,webstorm 会智能的提示你新建一个 watcher 任务:
sass、scss
编译 sass、scss 文件,你需要先安装 node-sass 模块。
npm install -g node-sass
安装好之后,就可以参考官方文档配置来写配置信息
-w, --watch Watch a directory or file -r, --recursive Recursively watch directories or files -o, --output Output directory -x, --omit-source-map-url Omit source map URL comment from output -i, --indented-syntax Treat data from stdin as sass code (versus scss) -q, --quiet Suppress log output except on error -v, --version Prints version info --output-style CSS output style (nested | expanded | compact | compressed) --indent-type Indent type for output CSS (space | tab) --indent-width Indent width; number of spaces or tabs (maximum value: 10) --linefeed Linefeed style (cr | crlf | lf | lfcr) --source-comments Include debug info in output --source-map Emit source map --source-map-contents Embed include contents in map --source-map-embed Embed sourceMappingUrl as data URI --source-map-root Base path, will be emitted in source-map as is --include-path Path to look for imported files --precision The amount of precision allowed in decimal numbers --importer Path to .js file containing custom importer --functions Path to .js file containing custom functions --help Print usage info
因为 webstorm 自带了 watch,因此不必配置 -w。最简单的配置是这样的:
node-sass source target
编译后的文件结构是这样的:
每个源文件都会对应一个 css 文件,非常便于管理,而且可以折叠起来,这是其他外置工具无法做到的。
less
less 编译方式大同小异。编译 sass、scss 文件,你需要先安装 less 模块。
-h, --help Prints help (this message) and exit.--include-path=PATHS Sets include paths. Separated by `:'. Use `;' on Windows.-M, --depends Outputs a makefile import dependency list to stdout.--no-color Disables colorized output.--no-ie-compat Disables IE compatibility checks.--no-js Disables JavaScript in less files-l, --lint Syntax check only (lint).-s, --silent Suppresses output of error messages.--strict-imports Forces evaluation of imports.--insecure Allows imports from insecure https hosts.-v, --version Prints version number and exit.-x, --compress Compresses output by removing some whitespaces.--source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map).--source-map-rootpath=X Adds this path onto the sourcemap filename and less file paths.--source-map-basepath=X Sets sourcemap base path, defaults to current working directory.--source-map-less-inline Puts the less files into the map instead of referencing them.--source-map-map-inline Puts the map (and any less files) into the output css file.--source-map-url=URL Sets a custom URL to map file, for sourceMappingURL commentin generated CSS file.-rp, --rootpath=URL Sets rootpath for url rewriting in relative imports and urlsWorks with or without the relative-urls option.-ru, --relative-urls Re-writes relative urls to the base less file.-sm=on|off Turns on or off strict math, where in strict mode, math.--strict-math=on|off Requires brackets. This option may default to on and thenbe removed in the future.-su=on|off Allows mixed units, e.g. 1px+1em or 1px*1px which have units--strict-units=on|off that cannot be represented.--global-var='VAR=VALUE' Defines a variable that can be referenced by the file.--modify-var='VAR=VALUE' Modifies a variable already declared in the file.--url-args='QUERYSTRING' Adds params into url tokens (e.g. 42, cb=42 or 'a=1&b=2')--plugin=PLUGIN=OPTIONS Loads a plugin. You can also omit the --plugin= if the plugin beginsless-plugin. E.g. the clean css plugin is called less-plugin-clean-cssonce installed (npm install less-plugin-clean-css), use either with--plugin=less-plugin-clean-css or just --clean-cssspecify options afterwards e.g. --plugin=less-plugin-clean-css="advanced"or --clean-css="advanced"
使用方法也很简单:
less source
更多
在重命名 sass、scss、less 文件时,webstorm 也会这样提示你:
阅读全文
0 0
- webstorm入门5-sass、scss、less监听编译
- webStorm 之sass/scss
- sass/scss、less
- Sass/Scss、Less是什么?
- less、sass、scss、compass
- Sass/SCSS(关系,安装,webstorm配置编译,使用,语法)
- vue 安装 sass,scss,less
- sass/scss 和 less的区别
- sass/scss 和 less的区别
- sass/scss 和 less的区别
- sass/scss 和 less的区别
- Less/Sass编译工具
- less-webstorm 编译配置
- WebStorm自动编译less
- 支持新版chrome,用webstorm编译形成css和sourcemap,调试sass和less源文件
- Re:从零开始的实习生活01----webstorm和intellij idea下如何自动编译sass和scss文件
- sass环境搭建以及webstorm中的scss配置
- SASS(SCSS)开发环境搭建(webstorm做编辑器)
- Spring框架的设计理念与设计模式分析
- Java回炉重造(七)使用Apache Commons Math创建向量
- 算法面试题:逆时针打印二叉树外围边缘
- C#——主进程负责向屏幕不间断输出四位随机数,子线程负责每隔 1 秒钟对当前计算机屏幕进行截屏并以 jpg 格式的图片保存文件。
- ES02--索引mapping的写入、查看与修改
- webstorm入门5-sass、scss、less监听编译
- MySql函数应用,分组排序,子查询学习笔记
- day11 eclise使用
- 逃跑按钮
- 多线程实现电梯程序——Map+Queue
- Oracle的子查询和集合运算
- SDUT-1132 C/C++经典程序训练2---斐波那契数列
- php 面向对象杂事儿
- 你为什么总过不了英语四六级?