Skip to content

Instantly share code, notes, and snippets.

@dschmidt
Last active August 29, 2015 14:06
Show Gist options
  • Save dschmidt/a68747348036fd6aa989 to your computer and use it in GitHub Desktop.
Save dschmidt/a68747348036fd6aa989 to your computer and use it in GitHub Desktop.
Speed up ember-cli builds by minimizing contents of bower_components/
#!/bin/bash
if [ -d "bower_components_source" ]; then
rm -rf bower_components/
mv bower_components_source bower_components
fi
bower install
TMP_DIR=tmp_save
rm -rf $TMP_DIR
mkdir -p $TMP_DIR/
IMPORTED_FILES=$(egrep "app.import\('*" Brocfile.js | grep -v vendor/ | grep -Po "\'.*?\'" | sed 's/^.\(.*\).$/\1/')
for f in $IMPORTED_FILES
do
# echo "Save imported file: $f"
mkdir -p $TMP_DIR/`dirname $f`
cp $f $TMP_DIR/$f
done
#SCSS_FILES=`find bower_components/foundation/ -type f | grep scss`
#for f in $SCSS_FILES
#do
## echo "Save foundation scss file: $f"
# mkdir -p $TMP_DIR/`dirname $f`
# cp $f $TMP_DIR/`dirname $f`
#done
EMBER_FILES=(
'ember/ember.js'
'ember-cli-shims/app-shims.js'
'ember-cli-test-loader/test-loader.js'
'ember-data/ember-data.js'
'ember-load-initializers/ember-load-initializers.js'
'ember-resolver/dist/modules/ember-resolver.js'
'jquery/dist/jquery.js'
'loader/loader.js'
'handlebars/handlebars.js'
'handlebars/handlebars.runtime.js'
'ember-qunit-notifications/passed.png'
'ember-qunit-notifications/failed.png'
'ember-qunit/dist/named-amd/main.js'
'ember-cli-shims/test-shims.js'
'qunit/qunit/qunit.js'
'qunit-notifications/index.js'
'qunit/qunit/qunit.css'
)
for f in "${EMBER_FILES[@]}"
do
# echo "Save ember file: $f"
mkdir -p $TMP_DIR/bower_components/`dirname $f`
cp bower_components/$f $TMP_DIR/bower_components/$f
done
mv bower_components/ bower_components_source/
mv $TMP_DIR/bower_components .
rm -rf $TMP_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment