Skip to content

Commit ff74a61

Browse files
Added npm run build command (#2356)
1 parent 5ff7932 commit ff74a61

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ You can learn more on [prismjs.com](https://prismjs.com/).
1616
Prism depends on community contributions to expand and cover a wider array of use cases. If you like it, considering giving back by sending a pull request. Here are a few tips:
1717

1818
- Read the [documentation](https://prismjs.com/extending.html). Prism was designed to be extensible.
19-
- Do not edit `prism.js`, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in the `components/` folder. The minified files are also generated automatically.
20-
- The build system uses [gulp](https://github.com/gulpjs/gulp) to minify the files and build `prism.js`. Having gulp installed, you just need to run the command `gulp`.
19+
- Do not edit `prism.js`, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in the `components/` folder. `prism.js` and all minified files are also generated automatically by our build system.
20+
- The build system uses [gulp](https://github.com/gulpjs/gulp) to minify the files and build `prism.js`. With all of Prism's dependencies installed, you just need to run the command `npm run build`.
2121
- Please follow the code conventions used in the files already. For example, I use [tabs for indentation and spaces for alignment](http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/). Opening braces are on the same line, closing braces on their own line regardless of construct. There is a space before the opening brace. etc etc.
2222
- Please try to err towards more smaller PRs rather than few huge PRs. If a PR includes changes I want to merge and changes I don't, handling it becomes difficult.
2323
- My time is very limited these days, so it might take a long time to review longer PRs (short ones are usually merged very quickly), especially those modifying the Prism Core. This doesn't mean your PR is rejected.
2424
- If you contribute a new language definition, you will be responsible for handling bug reports about that language definition.
25-
- If you add a new language definition, theme or plugin, you need to add it to `components.json` as well and rebuild Prism by running `gulp`, so that it becomes available to the download build page. For new languages, please also add a few [tests](https://prismjs.com/test-suite.html) and an example in the `examples/` folder.
25+
- If you [add a new language definition](https://prismjs.com/extending.html#creating-a-new-language-definition) or plugin, you need to add it to `components.json` as well and rebuild Prism by running `npm run build`, so that it becomes available to the download build page. For new languages, please also add a few [tests](https://prismjs.com/test-suite.html) and an example in the `examples/` folder.
26+
- Go to [prism-themes](https://github.com/PrismJS/prism-themes) if you want to add a new theme.
2627

2728
Thank you so much for contributing!!
2829

extending.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ <h1>Creating a new language definition</h1>
158158
<p><em>Note:</em> Any changes made to <code>components.json</code> require a rebuild (see step 3).</p>
159159
</li>
160160
<li>
161-
<p>Rebuild Prism by running <code class="language-bash">npx gulp</code>.</p>
161+
<p>Rebuild Prism by running <code class="language-bash">npm run build</code>.</p>
162162

163163
<p>This will make your language available to the <a href="test.html">test page</a>, or more precise: your local version of it. You can open your local <code>test.html</code> page in any browser, select your language, and see how your language definition highlights any code you input.</p>
164164

165-
<p><em>Note:</em> You have to reload the test page to apply changes made to <code>prism-foo-bar.js</code>.</p>
165+
<p><em>Note:</em> You have to reload the test page to apply changes made to <code>prism-foo-bar.js</code> but you don't have to rebuild Prism itself. However, if you change <code>components.json</code> (e.g. because you added a dependency) then these changes will not show up until you rebuild Prism.</p>
166166
</li>
167167
<li>
168168
<p>Write the language definition.</p>
@@ -255,7 +255,9 @@ <h1>Creating a new language definition</h1>
255255
We don't have any rules as to what counts as an example, so a single <em>Full example</em> section where you present the highlighting of the major features of the language is enough.</p>
256256
</li>
257257
<li>
258-
<p>Run <code class="language-bash">npx gulp</code> again.</p>
258+
<p>Run <code class="language-bash">npm run build</code> again.</p>
259+
260+
<p>Your language definition is now ready!</p>
259261
</li>
260262
</ol>
261263
</section>

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "prism.js",
66
"style": "themes/prism.css",
77
"scripts": {
8+
"build": "gulp",
89
"test:aliases": "mocha tests/aliases-test.js",
910
"test:core": "mocha tests/core/**/*.js",
1011
"test:dependencies": "mocha tests/dependencies-test.js",

0 commit comments

Comments
 (0)