Stackedit/tools/run_optimize

26 lines
818 B
Plaintext
Raw Normal View History

2013-05-18 14:52:20 +00:00
#!/bin/sh
2013-08-23 23:50:14 +00:00
echo
echo '### Installing dependencies ###'
2013-05-18 14:52:20 +00:00
npm install requirejs
2013-08-23 23:50:14 +00:00
npm install less
export PATH=${PATH}:`pwd`/node_modules/requirejs/bin/:`pwd`/node_modules/less/bin/
echo
echo '### Optimizing JavaScript ###'
rm -rf js-min
2013-07-07 20:23:00 +00:00
r.js -o tools/optimize-js.json
2013-08-23 23:50:14 +00:00
echo
echo '### Optimizing CSS ###'
mkdir -p js-min/themes
cd js/themes
for theme in *; do lessc $theme | sed 's/@import/@import (less)/g' | lessc -x - > `echo ../../js-min/themes/${theme} | sed 's/.less$/.css/'`; done
cd ../..
cp -R js/libs/fontello/font js-min/
cp -R js/img js-min/
echo
echo '### Updating cache.manifest ###'
sed -n '1,/#dynamic/p' cache.manifest > cache.manifest.new
printf "\n# `date`\n" >> cache.manifest.new
find js-min -type f >> cache.manifest.new
printf "\nNETWORK:\n*" >> cache.manifest.new
mv cache.manifest.new cache.manifest