项目作者: refgd

项目描述 :
Easy to compile TypeScript/Less/Sass/Scss, Minify JS/CSS With VS Code
高级语言: TypeScript
项目地址: git://github.com/refgd/easy-complie.git
创建时间: 2017-05-01T00:51:38Z
项目社区:https://github.com/refgd/easy-complie

开源协议:MIT License

下载


easy-compile README

Easily work with LESS/SASS/SCSS/TYPESCRIPT files in Visual Studio Code.

“Compile-on-save” for LESS/SASS/SCSS/TypeScript files without using a build task.

Features

  • Compile TypeScript and Less/Sass/Scss on save
  • Support autoprefixer for Less/Sass/Scss
  • Support mearge all media queries
  • Support inline setting (Only for Complie)
  • minify .js and .css files

Usage

Complie

For TypeScript, Only compile after you setup outfile or outdir.

Minify

Run Command “Minify - Easy Complie” to minify files

Extension Settings

Settting

easycompile.sass {}

easycompile.less {}

easycompile.typescript {}

easycompile.css {

"outDir": { string }

  • Redirect output to a different folder
  • support ${workspaceRoot}

    "outExt": { string }

  • allows you to specify an alternative output file extension
  • e.g. .min.css instead of .css

    "autoprefixer": { string }

  • this enables the autoprefixer plugin (included)
  • e,g. > 5%; last 2 Chrome versions; not ie 6-9

    "groupmedia": { boolean }

  • This enables the group media queries plugin (included)

    "sourceMap": { boolean }

    "sourceMapFileInline": { boolean }

    }

    easycompile.js {

    "outDir": { string }

  • Redirect output to a different folder
  • support ${workspaceRoot}

    "outExt": { string }

  • allows you to specify an alternative output file extension
  • e.g. .min.js instead of .js

    "surround": { string }

  • put string surround the code
  • e.g. (function (){ ${code} })()

    "compress": { object }

  • implement UglifyJS Compress setting [compress-options]

    }

Inline Setting (Only work for Less/Sass/Scss/Typescript)

  • Settings can also be specified per file as a comment on the first line.
  • Settings are comma-separated and strings are not “quoted”.
  • Example:

    1. // out: ../dist/app.css, compress: true, sourceMap: false, autoprefixer: last 5 versions, groupmedia: true
    2. body, html {
    3. ...
    4. }
    1. // outdir: ../../
    2. import * ...
    3. ...

Settings[Less/Scss/Sass]

main: { filepath: string | string[] }

  • Compiles a different less file instead of this one.
  • All other settings are ignored.
  • Filepath is relative to the current file.
  • Multiple main files can be specified (see FAQ).

out: { boolean | filepath: string | folderpath: string }

  • Redirects the css output to a different file.
  • This setting can be used to override a project-wide "out": false setting, where you only want certain .less files to be generated.
  • If filepath is used, but no file extension is specified, it will append .css
  • If folderpath is used, the less filename will be used, but with the .css extension
  • Filepath is relative to the current file.

    outExt: { string }

  • The default output extension is .css.
  • This allows you to specify an alternative output file extension (e.g. .wxss instead of .css)
  • This applies to the .map file also (e.g. .wxss.map)

compress: { boolean }

  • Compresses the css output by removing surplus white-space.

autoprefixer: { string | string[] }

  • When present, this enables the autoprefixer plugin (included).
  • This plugin automatically adds/removes vendor-prefixes needed to support a set of browsers which you specify.
  • The autoprefixer option is the comma-separated list of browsers for autoprefixer to use (or alternatively a string array of them).
  • See browserslist documentation for further examples of browser queries.
  • NOTE: If used with the inline setting, the browsers listed must be unquoted and semi-colon separated (because comma is already the directive separator): e.g.

    // autoprefixer: > 5%; last 2 Chrome versions; not ie 6-9, sourceMap: true, out: ../css/style.css

groupmedia: { boolean }

Tips

  • Ignore files
    1. "easycompile.compile": {
    2. "ignore" : [
    3. "**/_*.scss"
    4. ]
    5. }
    • Enable minify on save
      1. "easycompile.compile": {
      2. "minifyJsOnSave": true,
      3. "minifyCssOnSave": true
      4. }

Acknowledgements

Enjoy!