Created
March 2, 2018 18:55
-
-
Save thers/c4bc81c1e07348a20d6b59212f2c3e77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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