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",
|
"name": "theorangeone.net",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {},
|
"scripts": {
|
||||||
|
"build": "node scripts/build.js"
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@github:RealOrangeOne/theorangeone.net"
|
"url": "git@github:RealOrangeOne/theorangeone.net"
|
||||||
|
@ -9,11 +11,8 @@
|
||||||
"author": "Jake Howard <git@theorangeone.net>",
|
"author": "Jake Howard <git@theorangeone.net>",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"browserify": "14.3.0",
|
"browserify": "14.3.0",
|
||||||
"livereload": "0.6.2",
|
|
||||||
"ncp": "2.0.0",
|
"ncp": "2.0.0",
|
||||||
"node-sass": "4.5.2",
|
"node-sass": "4.5.2"
|
||||||
"node-watch": "0.5.2",
|
|
||||||
"uglifyify": "3.0.4"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "4.0.0-alpha.6",
|
"bootstrap": "4.0.0-alpha.6",
|
||||||
|
|
|
@ -1,65 +1,49 @@
|
||||||
const sass = require('node-sass');
|
const sass = require('node-sass');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const watch = require('node-watch');
|
|
||||||
const browserify = require('browserify');
|
const browserify = require('browserify');
|
||||||
const livereload = require('livereload');
|
|
||||||
const nsp = require('ncp').ncp;
|
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 OUT_FILE = path.join(STATIC, 'build', 'css', 'style.css');
|
||||||
const IN_FILE = path.join(STATIC, 'src', 'scss', 'style.scss');
|
const IN_FILE = path.join(STATIC, 'src', 'scss', 'style.scss');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const b = browserify({
|
const b = browserify({
|
||||||
entries:[path.join(STATIC, 'src', 'js', 'index.js')],
|
entries: [path.join(SRC_DIR, 'js', 'index.js')],
|
||||||
debug: true,
|
debug: true,
|
||||||
})
|
});
|
||||||
.transform({
|
|
||||||
global: true,
|
|
||||||
debug: true
|
|
||||||
}, 'uglifyify');
|
|
||||||
|
|
||||||
const bundle = function () {
|
const SASS_OPTIONS = {
|
||||||
b.bundle(function () {
|
file: path.join(SRC_DIR, 'scss', 'style.scss'),
|
||||||
console.log('built js');
|
outFile: path.join(BUILD_DIR, 'css', 'style.css'),
|
||||||
})
|
sourceMap: true,
|
||||||
.on('error', console.log)
|
sourceMapEmbed: true,
|
||||||
.pipe(fs.createWriteStream(path.join(STATIC, 'build', 'js', 'app.js')))
|
watch: true,
|
||||||
}
|
};
|
||||||
|
|
||||||
|
nsp(path.join('node_modules', 'font-awesome', 'fonts'), path.join(BUILD_DIR, 'fonts'), function (err) {
|
||||||
const buildSCSS = function () {
|
|
||||||
sass.render({
|
|
||||||
file: IN_FILE,
|
|
||||||
outFile: OUT_FILE,
|
|
||||||
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) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return console.error(err);
|
return console.error(err);
|
||||||
}
|
}
|
||||||
console.log('Copied fonts');
|
console.log('Copied fonts');
|
||||||
});
|
});
|
||||||
|
|
||||||
bundle();
|
b.bundle(function () {
|
||||||
buildSCSS();
|
console.log('built js');
|
||||||
//
|
})
|
||||||
// watch(path.join(STATIC, 'src', 'js'), {recursive: true}, bundle);
|
.on('error', console.error)
|
||||||
// watch(path.join(STATIC, 'src', 'scss'), {recursive: true}, buildSCSS);
|
.pipe(fs.createWriteStream(path.join(BUILD_DIR, 'js', 'app.js')))
|
||||||
//
|
|
||||||
//
|
|
||||||
// livereload.createServer().watch(path.join(STATIC, 'src'));
|
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