Pre-compiled files?
See original GitHub issueI guess I’m not the only one looking for a way to get a pre-compiled files of hljs. So far, I tried several ways to overcome this, but none of the following was completely satisfying.
Bower
Bower is probably where pre-compiled files would fit best, but the package available is not official and outdated (as you are aware).
npm
The package distributed on npm is made for — and that’s fine, I guess, since this is what npm is primarily made for. As I understand it I cannot use the node package to embed it on a website. So, instead I tried to build it using Gulp. Since it’s possible to specify any GitHub repository (if it comes with a package.json
) as a dependency, I tried building hljs using node.
"devDependencies": {
"highlight.js": "isagalaev/highlight.js"
},
"scripts": {
"postinstall": "node node_modules/highlight.js/tools/build.js :common"
}
Unfortunately, this does not seem to work due to a problem with file permissions (I wonder if including an empty build
folder would solve this). Next I tried gulp-shell to build directly from gulp, but the tasks aborts due to missing dependencies (of hljs).
cdnjs
Ultimately, I ended up using a Gulp task that downloads JS and CSS from cdnjs. It works, but it left me with a somewhat awkward feeling.
Is their another possibility I’m overlooking? Are there any plans to make this easier in the future? I suspect many users would welcome the idea to get pre-compiled files and Bower is maybe the right place for it. Just my two cents.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:4
- Comments:43 (32 by maintainers)
Top GitHub Comments
But you could publish the buid/minified files in the published NPM package so evey npm user could load it in their system without using the cdn version
@donny-dont if you want to build from source, just grab the source from GitHub. I don’t see much sense in duplicating the source inside a production package.