Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow hljs to be run from command line #1951

Merged
merged 6 commits into from
Feb 19, 2019
Merged

feat: allow hljs to be run from command line #1951

merged 6 commits into from
Feb 19, 2019

Conversation

marcoscaceres
Copy link
Contributor

This allows the ability for hljs's build script to be run from
the command line.

This is useful for sofware that requires hljs as part of a build
chain.

It disables generation of docs and demo by default.

The patch adds the following options to "tools/build.js":

  • --output: path to write build files to. Defaults to "build".
  • --docs: tells builder to include the docs and demo.

Build just for Web, don't include docs:

hljs --output "some/path xml" javascript

Build for Web, include docs:

hljs --docs --output "some/path" xml javascript

Build for NodeJS:

hljs -t node --output "some/path" xml javascript

Build for everything:

hljs -t all --output "some/path" xml javascript

This allows the ability for hljs's build script to be run from
the command line.

This is useful for sofware that requires hljs as part of a build
chain.

It disables generation of docs and demo by default.

The patch adds the following options to "tools/build.js":

 * `--output`: path to write build files to. Defaults to "build".
 * `--docs`: tells builder to include the docs and demo.

Build just for Web, don't include docs:

```Bash
hljs --output "some/path xml" javascript
```

Build for Web, include docs:

```Bash
hljs --docs --output "some/path" xml javascript
```

Build for NodeJS:

```Bash
hljs -t node --output "some/path" xml javascript
```

Build for everything:

```Bash
hljs -t all --output "some/path" xml javascript
```
Copy link
Collaborator

@egor-rogov egor-rogov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Documentation probably needs to be updated accordingly in building-testing.rst.
By the way, documentation on https://highlightjs.readthedocs.io/ is outdated (pre-9.13).

@marcoscaceres
Copy link
Contributor Author

Good point about the docs. I'll add some documentation before merging.

@marcoscaceres
Copy link
Contributor Author

@egor-rogov any idea how we would update https://highlightjs.readthedocs.io/ ?

@marcoscaceres marcoscaceres merged commit ee2ae80 into master Feb 19, 2019
@marcoscaceres marcoscaceres deleted the cli branch February 19, 2019 13:30
@egor-rogov
Copy link
Collaborator

any idea how we would update https://highlightjs.readthedocs.io/ ?

Hmm, I thought you have access to upload fresh docs, no?

@@ -21,6 +21,9 @@
"url": "git://github.com/highlightjs/highlight.js.git"
},
"main": "./lib/index.js",
"bin": {
"hljs": "./tools/build.js"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing tools/build.js file on npm package. #1984

marcoscaceres pushed a commit that referenced this pull request Feb 25, 2019
@marcoscaceres marcoscaceres restored the cli branch February 26, 2019 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants