Managing frontend assets with Bower
This is aimed at developers and applies to the ‘frontend’ application only.
If you wish to add static assets to the core project (i.e., javascript, css,
less files) please use bower to add and install them so we know what’s what
and when to upgrade.
If you wish to do a good deed for ArchivesSpace you can track down the source of any vendor assets not included in bower.json and get them updated and installed according to this protocol.
General Setup
Section titled “General Setup”Step 1: install npm
Section titled “Step 1: install npm”On OSX, for example:
brew install npmStep 2: install Bower
Section titled “Step 2: install Bower”npm install bower -gStep 3: install components
Section titled “Step 3: install components”bower installAdding a static asset to ASpace Frontend (Staff UI)
Section titled “Adding a static asset to ASpace Frontend (Staff UI)”Step 1: add the component
Section titled “Step 1: add the component”bower install <PACKAGE NAME> --saveStep 2: map Bower > Rails
Section titled “Step 2: map Bower > Rails”Edit the bower.json file to map the assets you want from bower_componentsto assets. See examples in bower.jsonThis is kind of a hack to workaround:https://github.com/blittle/bower-installer/issues/75Step 3: Install assets
Section titled “Step 3: Install assets”alias npm-exec='PATH=$(npm bin):$PATH'npm-exec bower-installerStep 4: Check assets in
Section titled “Step 4: Check assets in”Check the installed assets into Git. We version control bower.json and the installed files, but not the bower_components directory.
Production!
Section titled “Production!”Don’t forget - if you are adding assets that don’t have a .js extension, you need to add them to frontend/config/environments/production.rb