question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pre-compiled files?

See original GitHub issue

I 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:closed
  • Created 9 years ago
  • Reactions:4
  • Comments:43 (32 by maintainers)

github_iconTop GitHub Comments

11reactions
reyostallenbergcommented, Oct 16, 2016

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

9reactions
isagalaevcommented, Apr 30, 2016

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Precompiled Header Files | Microsoft Learn
You can precompile both C and C++ programs. In C++ programming, it's common practice to separate class interface information into header files.
Read more >
3.22 Using Precompiled Headers
A precompiled header file is searched for when #include is seen in the compilation. As it searches for the included file (see Search...
Read more >
Why use precompiled headers (C/C++)? - Stack Overflow
In C/C++, the #include mechanism is a textual copy of the file specified into the current file. Headers include other headers (which include ......
Read more >
4.20. Using Precompiled Headers - MIT
To create a precompiled header file, simply compile it as you would any other file, if necessary using the -x option to make...
Read more >
Precompiling ASP.NET Files with Visual Studio - Veracode Docs
... in Visual Studio to prepare binaries for a specific project in the Visual Studio solution. To precompile and deploy ASP.NET files for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found