Remove watching and cleanup build script
This commit is contained in:
parent
65822a743d
commit
080256df66
2 changed files with 32 additions and 49 deletions
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
"name": "theorangeone.net",
|
||||
"version": "1.0.0",
|
||||
"scripts": {},
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github:RealOrangeOne/theorangeone.net"
|
||||
|
@ -9,11 +11,8 @@
|
|||
"author": "Jake Howard <git@theorangeone.net>",
|
||||
"devDependencies": {
|
||||
"browserify": "14.3.0",
|
||||
"livereload": "0.6.2",
|
||||
"ncp": "2.0.0",
|
||||
"node-sass": "4.5.2",
|
||||
"node-watch": "0.5.2",
|
||||
"uglifyify": "3.0.4"
|
||||
"node-sass": "4.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "4.0.0-alpha.6",
|
||||
|
|
|
@ -1,65 +1,49 @@
|
|||
const sass = require('node-sass');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const watch = require('node-watch');
|
||||
const browserify = require('browserify');
|
||||
const livereload = require('livereload');
|
||||
const nsp = require('ncp').ncp;
|
||||
|
||||
const STATIC = path.join(__dirname, '..', 'static')
|
||||
const STATIC = path.join(__dirname, '..', 'static');
|
||||
|
||||
const SRC_DIR = path.join(STATIC, 'src');
|
||||
const BUILD_DIR = path.join(STATIC, 'build');
|
||||
|
||||
const OUT_FILE = path.join(STATIC, 'build', 'css', 'style.css');
|
||||
const IN_FILE = path.join(STATIC, 'src', 'scss', 'style.scss');
|
||||
|
||||
|
||||
|
||||
const b = browserify({
|
||||
entries:[path.join(STATIC, 'src', 'js', 'index.js')],
|
||||
entries: [path.join(SRC_DIR, 'js', 'index.js')],
|
||||
debug: true,
|
||||
})
|
||||
.transform({
|
||||
global: true,
|
||||
debug: true
|
||||
}, 'uglifyify');
|
||||
});
|
||||
|
||||
const bundle = function () {
|
||||
b.bundle(function () {
|
||||
console.log('built js');
|
||||
})
|
||||
.on('error', console.log)
|
||||
.pipe(fs.createWriteStream(path.join(STATIC, 'build', 'js', 'app.js')))
|
||||
}
|
||||
|
||||
|
||||
const buildSCSS = function () {
|
||||
sass.render({
|
||||
file: IN_FILE,
|
||||
outFile: OUT_FILE,
|
||||
const SASS_OPTIONS = {
|
||||
file: path.join(SRC_DIR, 'scss', 'style.scss'),
|
||||
outFile: path.join(BUILD_DIR, 'css', 'style.css'),
|
||||
sourceMap: true,
|
||||
sourceMapEmbed: true,
|
||||
watch: true,
|
||||
}, function (error, result) {
|
||||
if (!error) {
|
||||
fs.writeFileSync(OUT_FILE, result.css);
|
||||
console.log("Build CSS");
|
||||
} else {
|
||||
console.log("ERROR", error);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
nsp('node_modules/font-awesome/fonts', path.join(STATIC, 'build', 'fonts'), function (err) {
|
||||
nsp(path.join('node_modules', 'font-awesome', 'fonts'), path.join(BUILD_DIR, 'fonts'), function (err) {
|
||||
if (err) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log('Copied fonts');
|
||||
});
|
||||
|
||||
bundle();
|
||||
buildSCSS();
|
||||
//
|
||||
// watch(path.join(STATIC, 'src', 'js'), {recursive: true}, bundle);
|
||||
// watch(path.join(STATIC, 'src', 'scss'), {recursive: true}, buildSCSS);
|
||||
//
|
||||
//
|
||||
// livereload.createServer().watch(path.join(STATIC, 'src'));
|
||||
b.bundle(function () {
|
||||
console.log('built js');
|
||||
})
|
||||
.on('error', console.error)
|
||||
.pipe(fs.createWriteStream(path.join(BUILD_DIR, 'js', 'app.js')))
|
||||
|
||||
|
||||
sass.render(SASS_OPTIONS, function (error, result) {
|
||||
if (error) {
|
||||
return console.error("ERROR", error);
|
||||
}
|
||||
fs.writeFileSync(path.join(BUILD_DIR, 'css', 'style.css'), result.css);
|
||||
console.log("Build CSS");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue