File: vulcanize.md

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (59 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Vulcanizing Chrome Polymer UIs

`vulcanize` is an npm module used to combine resources.  In order to make the
Material Design downloads and history pages sufficiently fast, we run vulcanize
on the source files to combine them and reduce blocking load/parse time.

## Required software

Vulcanization currently requires:

- node.js: >= v4.4.2 (can be found with `node --version`)
- npm: >= 1.3.10 (can be found with `npm --version`)
- vulcanize: 1.14.8 (can be found with `vulcanize --version`)
- crisper: 2.0.1 (can be found with `npm list -g crisper`)
- uglifyjs: 2.4.10 (can be found with `uglifyjs --version`)
- polymer-css-build: 0.0.6 (can be found with `npm list -g polymer-css-build`)

## Installing required software

For instructions on installing node and npm, see
[here](https://docs.npmjs.com/getting-started/installing-node).

We recommend telling npm where to store downloaded modules:

```bash
$ npm config set -g prefix "$HOME/node_modules"
```

Then install the required modules:

```bash
$ npm install -g crisper@2.0.1 vulcanize@1.14.8 uglifyjs@2.4.10 \
    polymer-css-build@0.0.6
```

Ultimately, all that is required to run this script is that the node binaries
listed above are on your $PATH.

## Combining resources with vulcanize

To combine all the CSS/HTML/JS for all pages which use vulcanize, making them
production fast, you can run the command:

```bash
$ chrome/browser/resources/vulcanize.py  # from src/
```

This should overwrite the following files:

- chrome/browser/resources/md_downloads/
 - vulcanized.html (all <link rel=import> and stylesheets inlined)
 - crisper.js (all JavaScript, extracted from vulcanized.html)
- chrome/browser/resources/md_history/
 - app.vulcanized.html
 - app.crisper.js

## Testing downloads without vulcanizing

Build with `use_vulcanize = false` in your gn args to build without vulcanizing.