Quantcast
Channel: yosiopp »未分類
Viewing all articles
Browse latest Browse all 10

cssをscssに変換する

$
0
0

既に作ってしまったWEBサイトのcssをscssに変換できたら保守が楽!
ということで逆変換ができないのかなーと探してみたらありました。

http://css2sass.heroku.com/

cssからscssまたはsass形式に変換してくれます。
ほっほー、便利やなー。

他にもないかなーと思ってさらに探したら、
sassをインストールしたら一緒に導入されるsass-convertというコマンドがあるとのこと。

Usage: sass-convert [options] [INPUT] [OUTPUT]

Description:
  Converts between CSS, Sass, and SCSS files.
  E.g. converts from SCSS to Sass,
  or converts from CSS to SCSS (adding appropriate nesting).

Options:
    -F, --from FORMAT                The format to convert from. Can be css, scss, sass.
                                     By default, this is inferred from the input filename.
                                     If there is none, defaults to css.
    -T, --to FORMAT                  The format to convert to. Can be scss or sass.
                                     By default, this is inferred from the output filename.
                                     If there is none, defaults to sass.
    -R, --recursive                  Convert all the files in a directory. Requires --from and --to.
    -i, --in-place                   Convert a file to its own syntax.
                                     This can be used to update some deprecatedsyntax.
        --dasherize                  Convert underscores to dashes
        --indent NUM                 How many spaces to use for each level of indentation. Defaults to 2.
                                     "t" means use hard tabs.
        --old                        Output the old-style ":prop val" property syntax.
                                     Only meaningful when generating Sass.
    -C, --no-cache                   Don't cache to sassc files.
    -E encoding                      Specify the default encoding for Sass and CSS files.
    -s, --stdin                      Read input from standard input instead of an input file
        --trace                      Show a full traceback on error
        --unix-newlines              Use Unix-style newlines in written files.
    -?, -h, --help                   Show this message
    -v, --version                    Print version

なので、cssをscssに変換するならこんな感じ。

sass-convert -F css -T scss input.css output.scss

便利だー。

参考:

http://ozpa-h4.com/2013/03/07/css2sass/
http://hamatag.tumblr.com/post/6546627931/sass-converter


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images