Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
{
"path": "./dist/monolithic.js",
"maxSize": "1.0 kb"
"maxSize": "1.01 kb"
}
]
}
14 changes: 7 additions & 7 deletions src/monolithic.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ const parse = obj => {
const classNames = []

rules.forEach(rule => {
const cacheKey = JSON.stringify(rule)
if (cache[cacheKey]) {
classNames.push(cache[cacheKey])
const key = JSON.stringify(rule)
if (cache[key]) {
classNames.push(cache[key])
return
}
const className = prefix + cssRules.length.toString(36)
classNames.push(className)
const ruleset = createRule(Object.assign(rule, { className }))
insert(ruleset)
cache[cacheKey] = className
cache[key] = className
})

return classNames.join(' ')
Expand All @@ -78,9 +78,9 @@ module.exports.reset = () => {
module.exports.prefix = val => prefix = val

if (typeof document !== 'undefined') {
const style = document.head.appendChild(
document.createElement('style')
)
const s = document.createElement('style')
if (window) s.nonce = window.__webpack_nonce__
const style = document.head.appendChild(s)
const sheet = style.sheet
style.id = '_cxs_'
insert = rule => {
Expand Down