A rework plugin to read and inline CSS files via @import
npm install @fomantic/rework-import> ### Forked Version using updated dependencies and dropped sourceMap support
> Original repo at https://github.com/reworkcss/rework-import
> Import stylesheets using @import and an optional media query
``bash`
$ npm install --save rework-import
`js
var data = require('fs').readFileSync('index.css');
var imprt = require('rework-import');
var rework = require('rework');
rework(data)
.use(imprt({path: 'app/stylesheets'}))
.toString();
`
Type: String utf8
Default:
Use if your CSS is encoded in anything other than UTF-8.
Type: Array|String process.cwd()
Default: or __dirname of the rework source
A string or an array of paths in where to look for files.
_Note: nested @import will additionally benefit of the relative dirname of imported files._
Type: Function
A function to transform the content of imported files. Takes one argument and should return the modified content. Useful if you use css-whitespace.
`css
@import 'foo.css' (min-width: 25em);
body {
background: black;
}
`
yields:
`css
@media (min-width: 25em) {
body {
background: red;
}
h1 {
color: grey;
}
}
body {
background: black;
}
``
MIT © Jason Campbell and Kevin Mårtensson