Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
moved sass into helper
Browse files Browse the repository at this point in the history
  • Loading branch information
jackiboy committed Nov 23, 2018
1 parent 5c2390d commit 3cad32b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
27 changes: 4 additions & 23 deletions builder.js
@@ -1,26 +1,7 @@
const sass = require('node-sass');
const path = require('path');
const fs = require('fs');
const pathToFlagStyles = path.join(__dirname, './src/')
const sass = require('./helpers/sass');

sass.compile('flagpack', 'flagpack');


function compileSass(input, output){
sass.render({
file: path.join(pathToFlagStyles, input + '.scss'),
outputStyle: 'compressed'
}, function (err, result) {
if (!err) {
fs.writeFile(path.join(__dirname, './dist/', output + '.css'), result.css, function (err) {
if (!err) {
console.log('File written to: ', pathToFlagStyles)
} else {
console.error(err)
}
});
} else {
console.error(err)
}
})
}

compileSass('flagpack', 'flagpack');

23 changes: 23 additions & 0 deletions helpers/sass.js
@@ -0,0 +1,23 @@
const sass = require('node-sass');
const path = require('path');
const fs = require('fs');
const pathToFlagStyles = path.join(__dirname, '../src/')

exports.compile = function (input, output){
sass.render({
file: path.join(pathToFlagStyles, input + '.scss'),
outputStyle: 'compressed'
}, function (err, result) {
if (!err) {
fs.writeFile(path.join(__dirname, '../dist/', output + '.css'), result.css, function (err) {
if (!err) {
console.log('File written to: ', pathToFlagStyles)
} else {
console.error(err)
}
});
} else {
console.error(err)
}
})
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"homepage": "https://flag.pk/world",
"scripts": {
"build": "node builder.js"
"compile:sass": "node builder.js"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 3cad32b

Please sign in to comment.