Skip to content

Latest commit

 

History

History
158 lines (103 loc) · 2.86 KB

Setup_and_Usage.md

File metadata and controls

158 lines (103 loc) · 2.86 KB

SETUP

Dependencies

  • Node, npm (preferably using nvm)
  • GraphicsMagick for resizing images using the media:imageversions tasks
  • Optional: Vagrant

Install

Recommendation: Use nvm to allow for a standardized node environment:

nvm use
# if the specified version is not yet present: nvm install

Install dependencies:

npm install
# Shortcut: npm i

Options

Use Vagrant:

# Start box (downloads it initially)
vagrant up

# Connect to box and move to project directory
vagrant ssh
cd /vagrant/

# Continue above (nvm is preinstalled in the box)

USAGE

Use nvm in current bash session (if already used to install dependencies or using the Vagrant box):

nvm use

Start server. Access on http://localhost:9000 (or http://192.168.33.10:9000 when using Vagrant):

npm start
# This will run "gulp --dev"
# dev flag makes sure the server and watcher don't crash on error

Build:

npm run build

# Dev version:
npm run build -- --dev

Run specific tasks like css:

npm run gulp -- css
# Alternative: Install gulp globally and run "gulp css"

# Dev version
npm run gulp -- css --dev
# Alternative: Install gulp globally and run "gulp css --dev"

Install new npm dependency "foo" (used for client-side code, saved to dependencies):

npm install foo --save --save-exact
# Shortcut: npm i foo -S -E

npm shrinkwrap --dev

Install new npm dependency "bar" (used for the build environment, saved to devDependencies):

npm install bar --save-dev --save-exact
# Shortcut: npm i bar -D -E

npm shrinkwrap --dev

SPECIAL FEATURES

Source Maps

Estático generates source maps for both CSS and JS. How to enable them in your browser:


DEBUGGING

If "npm install" fails (e.g. ERR cb() never called):

# Update npm to latest version
npm install -g npm@latest

# Clean up
rm -rf node_modules
npm cache clean

# Try again
npm install

Log everything to get an idea of where it fails:

npm config set spin false
npm config set loglevel http

# Try again
npm install

If "npm install" still fails:

# Remove npm-shrinkwrap.json
rm npm-shrinkwrap.json

# Clean up
rm -rf node_modules
npm cache clean

# Try again
npm install

# Re-generate npm-shrinkwrap.json (including devDependencies)
npm shrinkwrap --dev

# Make sure the new npm-shrinkwrap.json works in the CI environment