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*
|
||||
|
||||
|
||||
### Custom ###
|
||||
static/src/scss/pygment.css
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
"version": "5.0.0",
|
||||
"description": " Source code for TheOrangeOne.net",
|
||||
"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-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": {
|
||||
"type": "git",
|
||||
|
|
|
@ -2,5 +2,6 @@ coverage==4.2
|
|||
Django>=1.10,<1.11
|
||||
flake8==3.2.1
|
||||
honcho==0.7.1
|
||||
pygments-style-github==0.4
|
||||
wagtail>=1.7,<1.8
|
||||
whitenoise==3.2.2
|
||||
|
|
|
@ -7,38 +7,38 @@ then
|
|||
echo ">>> WARNING: Building in Production Mode!"
|
||||
fi
|
||||
|
||||
mkdir -p theme/static/build/js/lib
|
||||
mkdir -p static/build/js/lib
|
||||
|
||||
if [ "$NODE_ENV" = "production" ]
|
||||
then
|
||||
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 theme/static/build/js/lib/* --compress --screw-ie8 --define --stats --keep-fnames -o theme/static/build/js/libs.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 static/build/js/lib/* --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/libs.js
|
||||
else
|
||||
echo ">> Building Libraries..."
|
||||
cp node_modules/bootstrap-sass/assets/javascripts/bootstrap.js theme/static/build/js/lib/bootstrap.js
|
||||
uglifyjs theme/static/build/js/lib/* --screw-ie8 --stats --keep-fnames -o theme/static/build/js/libs.js
|
||||
cp node_modules/bootstrap-sass/assets/javascripts/bootstrap.js static/build/js/lib/bootstrap.js
|
||||
uglifyjs static/build/js/lib/* --screw-ie8 --stats --keep-fnames -o static/build/js/libs.js
|
||||
fi
|
||||
|
||||
rm -rf theme/static/build/js/lib
|
||||
rm -rf static/build/js/lib
|
||||
|
||||
if [ "$NODE_ENV" = "production" ]
|
||||
then
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
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" ]
|
||||
then
|
||||
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
|
||||
|
||||
echo "> JS Built!"
|
||||
|
|
|
@ -8,16 +8,16 @@ then
|
|||
fi
|
||||
|
||||
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..."
|
||||
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..."
|
||||
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" ]
|
||||
then
|
||||
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
|
||||
|
|
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