Add a new beautifier SassConvert for CSS, SCSS and Sass

This commit is contained in:
Aidi Stan 2016-08-18 13:22:36 +08:00
parent b9f97895f9
commit bef88cf4dc
4 changed files with 26 additions and 0 deletions

View File

@ -86,6 +86,8 @@ before_install:
- gem install rubocop - gem install rubocop
- gem install htmlbeautifier - gem install htmlbeautifier
- gem install puppet-lint - gem install puppet-lint
# Sass language support
- gem install sass
# Python language support # Python language support
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo chmod 777 -R /opt/python; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo chmod 777 -R /opt/python; fi

View File

@ -93,6 +93,9 @@ install:
# Puppet-Lint # Puppet-Lint
- gem install puppet-lint - gem install puppet-lint
- where puppet-lint - where puppet-lint
# Sass
- gem install sass
- where sass-convert
# emacs # emacs
- cinst emacs -y - cinst emacs -y

View File

@ -62,6 +62,7 @@ module.exports = class Beautifiers extends EventEmitter
'rubocop' 'rubocop'
'ruby-beautify' 'ruby-beautify'
'rustfmt' 'rustfmt'
'sass-convert'
'sqlformat' 'sqlformat'
'stylish-haskell' 'stylish-haskell'
'tidy-markdown' 'tidy-markdown'

View File

@ -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
])