Skip to content

Instantly share code, notes, and snippets.

@thers
Created March 2, 2018 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thers/c4bc81c1e07348a20d6b59212f2c3e77 to your computer and use it in GitHub Desktop.
Save thers/c4bc81c1e07348a20d6b59212f2c3e77 to your computer and use it in GitHub Desktop.
const inliner = require('inline-css');
module.exports = function (content) {
const callback = this.async();
inliner(content, {
url: `file:///${this.context}/`,
removeHtmlSelectors: true,
})
.then((html) => {
callback(null, 'export default ' + JSON.stringify(html));
})
.catch((err) => {
console.error(`An error occurred during css inlining in ${this.context}`);
console.error(err);
callback(err);
});
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment