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.

Automatically downloaded customised files

See original GitHub issue

Motivation The feature where you can minify the code by selecting which languages you need support for before clicking ‘download’ is nice, but it would be great to do this automatically (e.g. to add to build tools).

Clicking the relevant checkboxes on the website generates a URL like https://prismjs.com/download.html#themes=prism-funky&languages=markup+css+clike+javascript+haskell+protobuf+purebasic

And we can evidently automatically create this URL. But then the “Download JS” and “Download CSS” buttons have to be pressed manually to trigger the actual download.

Description And endpoint or similar where I could download the CSS and JS files from a customised URL directly e.g.

GET https://prismjs.com/download.html#themes=prism-funky&languages=markup+css+clike+javascript+haskell+protobuf+purebasic?download=js

GET https://prismjs.com/download.html#themes=prism-funky&languages=markup+css+clike+javascript+haskell+protobuf+purebasic?download=css

Alternatives Visiting the website manually or trying to reverse engineer the javascript that triggers the download button.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
RunDevelopmentcommented, Oct 22, 2020

Instead of an npm task, we could also do a simple CLI. This could be used like this:

npx prismjs bundle --languages=html,css,java --out-js=./prism.js --out-css=./prism.css

We could also use a configuration file (maybe similar to this format?) instead of CLI arguments or both.

1reaction
RunDevelopmentcommented, May 26, 2020

Yeah, the script does a bunch of things…

The actual build process is quite easy. We just take the list of languages/plugins the user selected, pass it to getLoader, and get a sorted list of ids from that. We then concatenate all JS/CSS files (see the path attribute (each category has one)) of the sorted list of ids (in order) and that’s the final output.

(It also has to include prism-core.js and the actual theme. We also have to handle that only some plugins have CSS files.)

That’s the basics of what the build process is. Right now at least. It will be able to do more after #2162.

I also want to add that components.json, while required by getLoader, is not part of the public API and we might change the layout of the object at any time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatically download received files - Filemail
Filemail Desktop has the option to automatically download all received files to your computer/server.
Read more >
Solved: File items automatically taken from new added file
1. Triger is when a new file is added to a folder · 2. To take automatically that new file items if it's...
Read more >
My file automatically opens instead of saving when I download ...
By now, the file is already downloaded to the Downloads folder on your computer. Clicking the dropdown menu only gives you additional options....
Read more >
How to automatically open files downloaded from Safari?
Safari Preferences->General->Open "safe" files after downloading is checked. I want to automatically open file that might not be "safe". macos ...
Read more >
Download file and automatically save it to folder - Stack Overflow
This solution should work but can be broken very easily. Try to consider some web service listing the available files for download and...
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