本文介绍了在Webstorm中,如何自动前缀由less生成的CSS文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Webstorm 7(在Win7上),将我的.less文件编译成带有源映射的缩小的CSS(在nodejs v0.10.26上使用lessc,从Webstorm的File Watcher中运行),然后我可以对生成的文件运行autoprefixer css自动插入供应商前缀.

I've got Webstorm 7 (on Win7) compiling my .less files into minified css with sourcemaps (using lessc on nodejs v0.10.26, run from a File Watcher in Webstorm), and I can then run autoprefixer on that generated css to automatically insert vendor prefixes.

我不确定该怎么做,就是将两个步骤结合起来.可以在Webstorm中链接File Watchers吗?

What I'm not sure how to do, is combine the two steps. Is it possible to chain File Watchers in Webstorm?

可能的方法:

  • 创建一个从文件监视程序中调用的批处理脚本,然后依次调用less和autoprefixer.
  • 创建一个node.js脚本/模块,该脚本/模块调用较少,然后调用自动前缀.
  • 让较少编译器的CSS输出带有自定义扩展名(例如.unprefixedcss),然后专门为该扩展名提供文件监视程序.
  • 我想念的东西吗?

推荐答案

有一个用于less的插件,它无需添加观察者即可完成此工作:

There is a plugin for less which does this job without adding a watcher: https://github.com/less/less-plugin-autoprefix

安装后,您可以在Webstorms文件监视程序的输出参数中添加--autoprefix="…".

After installation you can add --autoprefix="…" to your arguments for the output in webstorms file watcher.

这篇关于在Webstorm中,如何自动前缀由less生成的CSS文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 05:54