rollup-plugin-css-only
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -38,3 +38,3 @@ 'use strict'; | ||
}, | ||
ongenerate: function ongenerate (opts, rendered) { | ||
ongenerate: function ongenerate (opts) { | ||
// No stylesheet needed | ||
@@ -73,8 +73,11 @@ if (!changes || options.output === false) { | ||
// Emit styles to file | ||
fs.writeFile(dest, css, function (err) { | ||
if (err) { | ||
throw err | ||
} | ||
console.log(green(dest), getSize(css.length)); | ||
}); | ||
return new Promise(function (resolve, reject) { | ||
fs.writeFile(dest, css, function (err) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}) | ||
} | ||
@@ -84,14 +87,2 @@ } | ||
function green (text) { | ||
return '\u001b[1m\u001b[32m' + text + '\u001b[39m\u001b[22m' | ||
} | ||
function getSize (bytes) { | ||
return bytes < 10000 | ||
? bytes.toFixed(0) + ' B' | ||
: bytes < 1024000 | ||
? (bytes / 1024).toPrecision(3) + ' kB' | ||
: (bytes / 1024 / 1024).toPrecision(4) + ' MB' | ||
} | ||
module.exports = css; |
@@ -36,3 +36,3 @@ import { writeFile } from 'fs'; | ||
}, | ||
ongenerate: function ongenerate (opts, rendered) { | ||
ongenerate: function ongenerate (opts) { | ||
// No stylesheet needed | ||
@@ -71,8 +71,11 @@ if (!changes || options.output === false) { | ||
// Emit styles to file | ||
writeFile(dest, css, function (err) { | ||
if (err) { | ||
throw err | ||
} | ||
console.log(green(dest), getSize(css.length)); | ||
}); | ||
return new Promise(function (resolve, reject) { | ||
writeFile(dest, css, function (err) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}) | ||
} | ||
@@ -82,14 +85,2 @@ } | ||
function green (text) { | ||
return '\u001b[1m\u001b[32m' + text + '\u001b[39m\u001b[22m' | ||
} | ||
function getSize (bytes) { | ||
return bytes < 10000 | ||
? bytes.toFixed(0) + ' B' | ||
: bytes < 1024000 | ||
? (bytes / 1024).toPrecision(3) + ' kB' | ||
: (bytes / 1024 / 1024).toPrecision(4) + ' MB' | ||
} | ||
export default css; |
{ | ||
"name": "rollup-plugin-css-only", | ||
"version": "0.1.0", | ||
"version": "0.2.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
9248
143