From c829230ed4686e4ded9a2d79745d2a16c99d3ff4 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sat, 2 May 2020 13:07:11 +0200 Subject: [PATCH 1/2] Added new `npm run build` command --- README.md | 7 ++++--- extending.html | 8 +++++--- package.json | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b09d6eb81f..2478355c9d 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,14 @@ You can learn more on [prismjs.com](https://prismjs.com/). 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: - Read the [documentation](https://prismjs.com/extending.html). Prism was designed to be extensible. -- 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. -- 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`. +- 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. +- 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`. - 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. - 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. - 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. - If you contribute a new language definition, you will be responsible for handling bug reports about that language definition. -- 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. +- 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. +- Go to [prism-themes](https://github.com/PrismJS/prism-themes) if you want to add a new theme. Thank you so much for contributing!! diff --git a/extending.html b/extending.html index de25798507..41f32363a9 100644 --- a/extending.html +++ b/extending.html @@ -158,11 +158,11 @@

Creating a new language definition

Note: Any changes made to components.json require a rebuild (see step 3).

  • -

    Rebuild Prism by running npx gulp.

    +

    Rebuild Prism by running npm run build.

    This will make your language available to the test page, or more precise: your local version of it. You can open your local test.html page in any browser, select your language, and see how your language definition highlights any code you input.

    -

    Note: You have to reload the test page to apply changes made to prism-foo-bar.js.

    +

    Note: You have to reload the test page to apply changes made to prism-foo-bar.js but you don't have to rebuild Prism itself. However, if you change components.json (e.g. because you added a dependency) then these changes will not show up until you rebuild Prism.

  • Write the language definition.

    @@ -255,7 +255,9 @@

    Creating a new language definition

    We don't have any rules as to what counts as an example, so a single Full example section where you present the highlighting of the major features of the language is enough.

  • -

    Run npx gulp again.

    +

    Run npm run build again.

    + +

    Your language definition is now ready!

  • diff --git a/package.json b/package.json index 0929771700..a9c11ec043 100755 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "prism.js", "style": "themes/prism.css", "scripts": { + "build": "npx gulp", "test:aliases": "mocha tests/aliases-test.js", "test:core": "mocha tests/core/**/*.js", "test:dependencies": "mocha tests/dependencies-test.js", From eeaeb9a571c39c1f12dbfb551ed58d9880416519 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Fri, 12 Jun 2020 16:33:52 +0200 Subject: [PATCH 2/2] Update package.json Co-authored-by: James DiGioia --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9c11ec043..66354563d9 100755 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "prism.js", "style": "themes/prism.css", "scripts": { - "build": "npx gulp", + "build": "gulp", "test:aliases": "mocha tests/aliases-test.js", "test:core": "mocha tests/core/**/*.js", "test:dependencies": "mocha tests/dependencies-test.js",