From bef88cf4dc31acc72e501c2cdfdd4701746ca86c Mon Sep 17 00:00:00 2001 From: Aidi Stan Date: Thu, 18 Aug 2016 13:22:36 +0800 Subject: [PATCH] Add a new beautifier SassConvert for CSS, SCSS and Sass --- .travis.yml | 2 ++ appveyor.yml | 3 +++ src/beautifiers/index.coffee | 1 + src/beautifiers/sass-convert.coffee | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 src/beautifiers/sass-convert.coffee diff --git a/.travis.yml b/.travis.yml index b91ab6b..80f98d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -86,6 +86,8 @@ before_install: - gem install rubocop - gem install htmlbeautifier - gem install puppet-lint + # Sass language support + - gem install sass # Python language support - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo chmod 777 -R /opt/python; fi diff --git a/appveyor.yml b/appveyor.yml index 07ce23f..7debaf4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -93,6 +93,9 @@ install: # Puppet-Lint - gem install puppet-lint - where puppet-lint + # Sass + - gem install sass + - where sass-convert # emacs - cinst emacs -y diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index 1e8bbc6..096e814 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -62,6 +62,7 @@ module.exports = class Beautifiers extends EventEmitter 'rubocop' 'ruby-beautify' 'rustfmt' + 'sass-convert' 'sqlformat' 'stylish-haskell' 'tidy-markdown' diff --git a/src/beautifiers/sass-convert.coffee b/src/beautifiers/sass-convert.coffee new file mode 100644 index 0000000..8e65da9 --- /dev/null +++ b/src/beautifiers/sass-convert.coffee @@ -0,0 +1,20 @@ +"use strict" +Beautifier = require('./beautifier') + +module.exports = class SassConvert extends Beautifier + name: "SassConvert" + link: "http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax" + + options: + # TODO: Add support for options + CSS: false + Sass: false + SCSS: false + + beautify: (text, language, options, context) -> + lang = language.toLowerCase() + + @run("sass-convert", [ + @tempFile("input", text), + "--from", lang, "--to", lang + ])