Skip to content

Instantly share code, notes, and snippets.

@roman01la
Last active April 29, 2016 00:28
Show Gist options
  • Select an option

  • Save roman01la/8dadfdac46dc0b08d1f8 to your computer and use it in GitHub Desktop.

Select an option

Save roman01la/8dadfdac46dc0b08d1f8 to your computer and use it in GitHub Desktop.
// Require hook
function hook(compile, extension) {
require.extensions[extension] = function(m, filename) {
const tokens = compile(filename);
return m._compile('module.exports = ' + JSON.stringify(tokens), filename);
};
}
// Run require hook
hook(fetch, '.css');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment