-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
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 ```
There was a problem hiding this 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).
Good point about the docs. I'll add some documentation before merging. |
@egor-rogov 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" |
There was a problem hiding this comment.
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
This reverts commit ee2ae80.
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