setup static build step
This commit is contained in:
parent
435907732b
commit
1cee2677d3
8 changed files with 23 additions and 15 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -165,3 +165,7 @@ jspm_packages
|
||||||
|
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
.nfs*
|
.nfs*
|
||||||
|
|
||||||
|
|
||||||
|
### Custom ###
|
||||||
|
static/src/scss/pygment.css
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"description": " Source code for TheOrangeOne.net",
|
"description": " Source code for TheOrangeOne.net",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"create-build-dirs": "mkdir -p static/build/js/lib static/build/fonts static/build/css static/build/img",
|
||||||
"build-js": "./scripts/build-js.sh",
|
"build-js": "./scripts/build-js.sh",
|
||||||
"build-scss": "./scripts/build-scss.sh"
|
"build-scss": "./scripts/build-scss.sh",
|
||||||
|
"build": "npm run create-build-dirs && npm run build-scss && npm run build-js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -2,5 +2,6 @@ coverage==4.2
|
||||||
Django>=1.10,<1.11
|
Django>=1.10,<1.11
|
||||||
flake8==3.2.1
|
flake8==3.2.1
|
||||||
honcho==0.7.1
|
honcho==0.7.1
|
||||||
|
pygments-style-github==0.4
|
||||||
wagtail>=1.7,<1.8
|
wagtail>=1.7,<1.8
|
||||||
whitenoise==3.2.2
|
whitenoise==3.2.2
|
||||||
|
|
|
@ -7,38 +7,38 @@ then
|
||||||
echo ">>> WARNING: Building in Production Mode!"
|
echo ">>> WARNING: Building in Production Mode!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p theme/static/build/js/lib
|
mkdir -p static/build/js/lib
|
||||||
|
|
||||||
if [ "$NODE_ENV" = "production" ]
|
if [ "$NODE_ENV" = "production" ]
|
||||||
then
|
then
|
||||||
echo ">> Compressing Libraries..."
|
echo ">> Compressing Libraries..."
|
||||||
uglifyjs node_modules/bootstrap-sass/assets/javascripts/bootstrap.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/lib/bootstrap.js
|
uglifyjs node_modules/bootstrap-sass/assets/javascripts/bootstrap.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/lib/bootstrap.js
|
||||||
uglifyjs theme/static/build/js/lib/* --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/libs.js
|
uglifyjs static/build/js/lib/* --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/libs.js
|
||||||
else
|
else
|
||||||
echo ">> Building Libraries..."
|
echo ">> Building Libraries..."
|
||||||
cp node_modules/bootstrap-sass/assets/javascripts/bootstrap.js theme/static/build/js/lib/bootstrap.js
|
cp node_modules/bootstrap-sass/assets/javascripts/bootstrap.js static/build/js/lib/bootstrap.js
|
||||||
uglifyjs theme/static/build/js/lib/* --screw-ie8 --stats --keep-fnames -o theme/static/build/js/libs.js
|
uglifyjs static/build/js/lib/* --screw-ie8 --stats --keep-fnames -o static/build/js/libs.js
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf theme/static/build/js/lib
|
rm -rf static/build/js/lib
|
||||||
|
|
||||||
if [ "$NODE_ENV" = "production" ]
|
if [ "$NODE_ENV" = "production" ]
|
||||||
then
|
then
|
||||||
echo ">> Compressing jQuery..."
|
echo ">> Compressing jQuery..."
|
||||||
uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/jquery.js
|
uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/jquery.js
|
||||||
else
|
else
|
||||||
echo ">> Building jQuery..."
|
echo ">> Building jQuery..."
|
||||||
cp node_modules/jquery/dist/jquery.js theme/static/build/js/jquery.js
|
cp node_modules/jquery/dist/jquery.js static/build/js/jquery.js
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo ">> Building Application JS..."
|
echo ">> Building Application JS..."
|
||||||
browserify -t [ babelify --presets [ es2015 react ] ] theme/static/src/js/app.js -o theme/static/build/js/app.js
|
browserify -t [ babelify --presets [ es2015 react ] ] static/src/js/app.js -o static/build/js/app.js
|
||||||
|
|
||||||
if [ "$NODE_ENV" = "production" ]
|
if [ "$NODE_ENV" = "production" ]
|
||||||
then
|
then
|
||||||
echo ">> Compressing Application..."
|
echo ">> Compressing Application..."
|
||||||
uglifyjs theme/static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/app.js
|
uglifyjs static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/app.js
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "> JS Built!"
|
echo "> JS Built!"
|
||||||
|
|
|
@ -8,16 +8,16 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ">> Generating Pygments styles..."
|
echo ">> Generating Pygments styles..."
|
||||||
env/bin/pygmentize -S github -f html -a .highlight > theme/static/src/scss/pygment.css
|
env/bin/pygmentize -S github -f html -a .highlight > static/src/scss/pygment.css
|
||||||
|
|
||||||
echo ">> Building SCSS..."
|
echo ">> Building SCSS..."
|
||||||
node-sass theme/static/src/scss/index.scss theme/static/build/css/index.css --source-map-embed
|
node-sass static/src/scss/index.scss static/build/css/index.css --source-map-embed
|
||||||
|
|
||||||
echo ">> Post-Processing..."
|
echo ">> Post-Processing..."
|
||||||
postcss -u autoprefixer -o theme/static/build/css/index.css theme/static/build/css/index.css
|
postcss -u autoprefixer -o static/build/css/index.css static/build/css/index.css
|
||||||
|
|
||||||
if [ "$NODE_ENV" = "production" ]
|
if [ "$NODE_ENV" = "production" ]
|
||||||
then
|
then
|
||||||
echo ">> Compressing CSS..."
|
echo ">> Compressing CSS..."
|
||||||
cleancss -d --s0 -o theme/static/build/css/index.css theme/static/build/css/index.css
|
cleancss -d --s0 -o static/build/css/index.css static/build/css/index.css
|
||||||
fi
|
fi
|
||||||
|
|
1
static/src/scss/index.scss
Executable file
1
static/src/scss/index.scss
Executable file
|
@ -0,0 +1 @@
|
||||||
|
@import 'pygment';
|
Reference in a new issue