summaryrefslogtreecommitdiffstats
path: root/devtools/shared/jsbeautify/UPGRADING.md
blob: dc6e0fe43965bbc18048379615a525350aa1eb25 (plain)
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
# UPGRADING

1. `git clone https://github.com/beautify-web/js-beautify.git`

2. Copy `js/lib/beautify.js` to `devtools/shared/jsbeautify/src/beautify-js.js`

3. Remove the acorn section from the file and add the following to the top:

 ```
 const acorn = require("acorn/acorn");
 ```

4. Just above `function Beautifier(js_source_text, options) {` add:

 ```
 exports.jsBeautify = js_beautify;
 ```

5. Copy `beautify-html.js` to `devtools/shared/jsbeautify/src/beautify-html.js`

6. Replace the require blocks at the bottom of the file with:

 ```
 var beautify = require('devtools/shared/jsbeautify/beautify');

 exports.htmlBeautify = function(html_source, options) {
    return style_html(html_source, options, beautify.js, beautify.css);
 };
 ```

7. Copy `beautify-css.js` to `devtools/shared/jsbeautify/src/beautify-css.js`

8. Replace the global define block at the bottom of the file with:
 ```
 exports.cssBeautify = css_beautify;
 ```
9. Copy `js/test/beautify-tests.js` to `devtools/shared/jsbeautify/src/beautify-tests.js`