rollup-plugin-css-only
Advanced tools
Comparing version 0.0.4 to 0.1.0
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var fs = require('fs'); | ||
@@ -11,6 +9,6 @@ var rollupPluginutils = require('rollup-pluginutils'); | ||
var filter = rollupPluginutils.createFilter(options.include || ['**/*.css'], options.exclude) | ||
var styles = {} | ||
var dest = options.output | ||
var changes = 0 | ||
var filter = rollupPluginutils.createFilter(options.include || ['**/*.css'], options.exclude); | ||
var styles = {}; | ||
var dest = options.output; | ||
var changes = 0; | ||
@@ -35,4 +33,4 @@ return { | ||
if (styles[id] !== code && (styles[id] || code)) { | ||
styles[id] = code | ||
changes++ | ||
styles[id] = code; | ||
changes++; | ||
} | ||
@@ -47,8 +45,8 @@ | ||
} | ||
changes = 0 | ||
changes = 0; | ||
// Combine all stylesheets | ||
var css = '' | ||
var css = ''; | ||
for (var id in styles) { | ||
css += styles[id] || '' | ||
css += styles[id] || ''; | ||
} | ||
@@ -58,3 +56,3 @@ | ||
if (typeof options.output === 'function') { | ||
options.output(css, styles) | ||
options.output(css, styles); | ||
return | ||
@@ -70,7 +68,7 @@ } | ||
// Guess destination filename | ||
dest = opts.dest || 'bundle.js' | ||
dest = opts.dest || 'bundle.js'; | ||
if (dest.endsWith('.js')) { | ||
dest = dest.slice(0, -3) | ||
dest = dest.slice(0, -3); | ||
} | ||
dest = dest + '.css' | ||
dest = dest + '.css'; | ||
} | ||
@@ -83,4 +81,4 @@ | ||
} | ||
emitted(dest, css.length) | ||
}) | ||
console.log(green(dest), getSize(css.length)); | ||
}); | ||
} | ||
@@ -90,6 +88,2 @@ } | ||
function emitted (text, bytes) { | ||
console.log(green(text), getSize(bytes)) | ||
} | ||
function green (text) { | ||
@@ -107,5 +101,2 @@ return '\u001b[1m\u001b[32m' + text + '\u001b[39m\u001b[22m' | ||
exports['default'] = css; | ||
exports.emitted = emitted; | ||
exports.green = green; | ||
exports.getSize = getSize; | ||
module.exports = css; |
@@ -7,6 +7,6 @@ import { writeFile } from 'fs'; | ||
var filter = createFilter(options.include || ['**/*.css'], options.exclude) | ||
var styles = {} | ||
var dest = options.output | ||
var changes = 0 | ||
var filter = createFilter(options.include || ['**/*.css'], options.exclude); | ||
var styles = {}; | ||
var dest = options.output; | ||
var changes = 0; | ||
@@ -31,4 +31,4 @@ return { | ||
if (styles[id] !== code && (styles[id] || code)) { | ||
styles[id] = code | ||
changes++ | ||
styles[id] = code; | ||
changes++; | ||
} | ||
@@ -43,8 +43,8 @@ | ||
} | ||
changes = 0 | ||
changes = 0; | ||
// Combine all stylesheets | ||
var css = '' | ||
var css = ''; | ||
for (var id in styles) { | ||
css += styles[id] || '' | ||
css += styles[id] || ''; | ||
} | ||
@@ -54,3 +54,3 @@ | ||
if (typeof options.output === 'function') { | ||
options.output(css, styles) | ||
options.output(css, styles); | ||
return | ||
@@ -66,7 +66,7 @@ } | ||
// Guess destination filename | ||
dest = opts.dest || 'bundle.js' | ||
dest = opts.dest || 'bundle.js'; | ||
if (dest.endsWith('.js')) { | ||
dest = dest.slice(0, -3) | ||
dest = dest.slice(0, -3); | ||
} | ||
dest = dest + '.css' | ||
dest = dest + '.css'; | ||
} | ||
@@ -79,4 +79,4 @@ | ||
} | ||
emitted(dest, css.length) | ||
}) | ||
console.log(green(dest), getSize(css.length)); | ||
}); | ||
} | ||
@@ -86,6 +86,2 @@ } | ||
function emitted (text, bytes) { | ||
console.log(green(text), getSize(bytes)) | ||
} | ||
function green (text) { | ||
@@ -103,2 +99,2 @@ return '\u001b[1m\u001b[32m' + text + '\u001b[39m\u001b[22m' | ||
export { emitted, green, getSize };export default css; | ||
export default css; |
{ | ||
"name": "rollup-plugin-css-only", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "Rollup plugin that bundles imported css", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9740
157