Skip to content

Commit

Permalink
Generate minified css.
Browse files Browse the repository at this point in the history
  • Loading branch information
Templarian committed Aug 3, 2019
1 parent ea11f6f commit c978318
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
17 changes: 14 additions & 3 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const yargs = require('yargs');
const webfont = require("webfont").default;
const sass = require('node-sass');
const uglifycss = require('uglifycss');
const fs = require('fs');
const path = require('path');

Expand Down Expand Up @@ -168,12 +167,24 @@ function generateCSS() {
if (err) {
console.error(err);
} else {
console.log(result);
fs.writeFileSync(path.join(distFolder, 'css', `${fileName}.css`), result.css);
fs.writeFileSync(path.join(distFolder, 'css', `${fileName}.css.map`), result.map);
}
});
console.log(`- Generated ${fileName}.css`);
sass.render({
file: path.resolve(distFolder, 'scss', `${fileName}.scss`),
outputStyle: 'compressed',
sourceMap: true,
outFile: `${fileName}.css`
}, function(err, result) {
if (err) {
console.error(err);
} else {
fs.writeFileSync(path.join(distFolder, 'css', `${fileName}.min.css`), result.css);
fs.writeFileSync(path.join(distFolder, 'css', `${fileName}.min.css.map`), result.map);
}
});
console.log(`- Generated ${fileName}.css / *.min.css / *.map`);
}

webfont({
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"license": "MIT",
"devDependencies": {
"node-sass": "^4.12.0",
"uglifycss": "0.0.29",
"webfont": "^9.0.0",
"yargs": "^13.3.0"
}
Expand Down

0 comments on commit c978318

Please sign in to comment.