Skip to content
This repository has been archived by the owner on Mar 22, 2019. It is now read-only.

hail2u/postcss-single-charset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

postcss-single-charset

A PostCSS plugin for popping first @charset rule up in CSS file

SYNOPSIS

Sometimes concatenated CSS file has @charset directive in the middle or has many @charset directives:

.foo {
  color: red;
}

@charset "Shift_JIS";

.bar {
  color: green;
}

@charset "Shift_JIS";

.baz {
  color: blue;
}

This PostCSS plugin fixes these invalid @charset like this:

@charset "Shift_JIS";

.foo {
  color: red;
}

.bar {
  color: green;
}

.baz {
  color: blue;
}

INSTALL

$ npm install postcss-single-charset

USAGE

var fs = require("fs");
var postcss = require("postcss");

var css = fs.readFileSync("input.css", "utf8");
postcss([
  require("postcss-single-charset")()
]).process(css).then(function (result) {
  fs.writeFileSync("output.css", result.css);
});

LICENSE

MIT: http://hail2u.mit-license.org/2015

About

A PostCSS plugin for popping first @charset rule up in CSS file

Resources

Stars

Watchers

Forks

Packages

No packages published