-
-
Save egoist/7460f76907edc8eea578154db8cc328a to your computer and use it in GitHub Desktop.
Created by gist-it (https://github.com/egoist/gist-it)
This file contains 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
import './a.css' |
This file contains 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
(function () { | |
'use strict'; | |
function styleInject(css, ref) { | |
if ( ref === void 0 ) ref = {}; | |
var insertAt = ref.insertAt; | |
if (!css || typeof document === 'undefined') { return; } | |
var head = document.head || document.getElementsByTagName('head')[0]; | |
var style = document.createElement('style'); | |
style.type = 'text/css'; | |
if (insertAt === 'top') { | |
if (head.firstChild) { | |
head.insertBefore(style, head.firstChild); | |
} else { | |
head.appendChild(style); | |
} | |
} else { | |
head.appendChild(style); | |
} | |
if (style.styleSheet) { | |
style.styleSheet.cssText = css; | |
} else { | |
style.appendChild(document.createTextNode(css)); | |
} | |
} | |
var css = "body {\n color: red;\n}\n"; | |
styleInject(css); | |
}()); |
This file contains 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
{ | |
"name": "test", | |
"version": "1.0.0", | |
"license": "MIT", | |
"devDependencies": { | |
"rollup": "^0.56.3", | |
"rollup-plugin-commonjs": "^8.3.0", | |
"rollup-plugin-node-resolve": "^3.0.3", | |
"rollup-plugin-postcss": "^1.3.1" | |
} | |
} |
This file contains 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
export default { | |
input: './input.js', | |
output: { | |
file: 'out.js', | |
format: 'iife' | |
}, | |
plugins: [ | |
require('rollup-plugin-node-resolve')({ jsnext: true, main: true, browser: true }), | |
require('rollup-plugin-commonjs')(), | |
require('rollup-plugin-postcss')() | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment