UNPKG

2.48 kBMarkdownView Raw
1# Gulp based builds.
2
3## MacOSX: Installing glue:
4```shell
5# install 'native' (not Apple-supplied) Python to be able to install 'glue' tool:
6brew install python
7
8# install 'glue' tool needed by build:
9brew install jpeg
10pip install glue
11
12# install Karma globally for tests to start:
13npm install -g karma-cli
14```
15
16## Build steps:
17* export your `NPM_TOKEN`
18* Copy and rename the seed_package.json to package.json (only when bootstraping new projects)
19* Run `npm run setup` to install and build all required dependencies
20* Run `npm run dev` to build files suitable for wathcing and startup a watch server
21* Run `npm run build` to build a package suitable for production
22* Run `npm run test` to run karma test suites
23
24## Build pipeline
25
26###stlye/*.less, *.sass, *.css
27 Run through SASS or LESS > dist/ -> concat -> uglify -> gzip -> build/
28
29###src/*.js
30 Babel (ES6) > concat -> uglify -> gzip -> build/
31
32Concatenation order is specifed by the ES6 import declaration
33```javascript
34import assign from './utils/Utils.js'
35import Form from './Form.js'
36```
37
38
39
40###src/*.hbs
41 Handlebars -> concat into main JS, available in browser as TEMPLATES['name without extension']
42
43###resources/*, *.html
44 Copied as is to build directory
45
46###sprites/{set}/*.png|jpg|gif
47
48Compiles all images into a single sprite call {set}.png sprites can be used like:
49
50```html
51<span class="sprite-{set}-{filebase}"/>
52```
53
54## Customizing builds using bower.json and package.json
55
56
57#### bower.json
58All bower dependencies with main files are concatenanted together, this can be overriden in bower.json as follows:
59
60```json
61"overrides": {
62 "bootstrap": {
63 "main": [
64 "dist/js/bootstrap.js",
65 "dist/css/bootstrap.css",
66 "dist/css/bootstrap.css.map"
67 ]
68 },
69 }
70```
71
72To exclude certain large libraries from concatenantion list in exclude, the main files will be concated together and placed in build/<libray name>
73```json
74 "standalone": ["handsontable", "codemirror"]
75```
76
77To exclude libraries that have already been packaged elsewhere:
78```json
79"excludes": ["jquery"]
80```
81
82To copy entire directories from dependencies:
83
84```json
85"directories": {
86 "fontawesome": "fonts/*",
87 "bootstrap": "fonts/*"
88 },
89```
90
91To create a plugin package:
92
93```json
94"plugin": "PortalApp",
95```
96This will create a .zip instead of a .war and place all the compiled .js file in to a subdirectory *System/plugins/{plugin}*
97