How to proper integrate PrismJS into a Eleventy project? - prismjs

I'm building a site using eleventy and want to include code examples with code-highlighting. Prism looks like a great choice for this. How would I add it proper to the build process (not as CDN)?

Use the download option. This gives you the JS/CSS you need. Copy it to your site and ensure you are using the "Passthrough File Copy" (https://www.11ty.dev/docs/copy/) option to copy CSS and JS files over.

Related

How To Upload Vue.js project in Live Server

I believe it is much the same as a vue.js 2.6 upload. I have my setup as follows, is this correct? Is the only file I need to amend the index.html file which in my case is in the techjobs folder? I have amended this file to suit the directory structure. Are there any other files.Please provide .htaccess file
I'm not sure about what are you asking, could you try to modify tour question, please?
Anyways, if what do you want is to know the way to compile and push to a production environment, there are several options like Firebase, Netlify, Github pages, etc.
You can use this documentation where you can follow step by step how to push to production.
https://cli.vuejs.org/guide/deployment.html#general-guidelines

Dropwizard serve external images directory

I have a dropwizard API app and I want one endpoint where I can run the call and also upload and image, these images have to be saved in a directory and then served through the same application context.
Is it possible with dropwizard? I can only find static assets bundles.
There is similar question already: Can DropWizard serve assets from outside the jar file?
The above module is mentioned in the third party modules list of dropwizard. There is also official modules list. These two lists are hard to find maybe because the main documentation doesn't reference them.
There is also dropwizard-file-assets which seems new. I don't know which module will work best for your case. Both are based on dropwizard's AssetServlet
If you don't like them you could use it as example how to implement your own. I suspect that the resource caching part may not be appropriate for your use case if someone replace the same resource name with new content: https://github.com/dirkraft/dropwizard-file-assets/blob/master/src/main/java/com/github/dirkraft/dropwizard/fileassets/FileAssetServlet.java#L129-L141
Edit: This is simple project that I've made using dropwizard-configurable-assets-bundle. Follow the instructions in the README.md. I think it is doing exactly what you want: put some files in a directory somewhere on the file system (outside the project source code) and serve them if they exist.

Combine all my custom JS into one single file with dojo build

I'm having a hard time trying to set up dojo build in my project.
Basically, I have my js folder with all my custom widgets and components. I simply want to combine all javascript files form js folder into one single file.
dojo sources are located outside this folder. The structure looks similar to this:
/public
/prod
/dojo-1.9
/dijit
/dojo
/dojox
/js
myScript1.js
myScript2.js
Do you have any idea on how should I configure the package.json and profile.js? The documentation doesn't seem to help since all I am getting is an output folder with the same contents as the js folder (no javascript is merged).
You can start by reading this article:
https://dojotoolkit.org/reference-guide/1.10/build/simpleExample.html
It provides a simplified overview of dojo build system.
Additional there is dojo boilerplate with a sample of folder structure and profile.js configuration for quick start here:
https://github.com/csnover/dojo-boilerplate
I definitely suggest you to use the boilerplate as start for your project as it simplify a lot initial configurations.

PhantomJS/CasperJS IDE Helper

Is there any way to get IDE support for CasperJS functions? I am currently using PhpStorm, but also tried in netbeans, it won't know which functions are defined. It is quite irritating that I get Unresolved variable / undefined function IDE warnings for all the functions.
I tried to copy \casperjs\modules\*.js files to the project, most of the functions got "defined".
PhpStorm: Download the casperjs.zip from casperjs.org, it will contain a modules folder, copy every .js file to your project. (I put them in an IDE_HELPER folder)
An IDE helper javascript file would still be much better, but it is working.
Alternatively: You can also attach these files as external libraries, so it won't bother you while browsing your own files.
It should work in other IDEs too.
Disclaimer: I'm talking about JetBrains products.
I encountered this problem myself. The easiest way to solve it is to click on a bottom right icon (Finally, I understand that is this for!).
It will show you which libraries are associated with an open file. The only thing you have to do is to click on «Libraries in scope» and add your library by clicking «Download»
I know it's an old post, but after not finding any IDE Helper too I managed to write a script that creates one by scraping the content off of the official docs. You can find out more about the IDE Helper on my website:
http://christophersax.com/2016/casperjs-ide-helper/
(It's free of course)
I hope it helps!
You can add casperjs as a Resource in your Preferences.
Go to Project > Directories > + Add Content Root > Add casperjs folder then > Mark as Resource Root.

Changing Inside Assets Folder In Yii Framework

I came to notice that there is one folder called assets in the root folder.To know more about it,I went through this link.Now I want to know adding some css in these files is good or shall I add css to to the main.css file inside css folder.
The asset folder is automatically generated by Yii based upon your environment so best avoid putting your CSS, images etc inside here. It also best to not commit these folders and files into SVN as they are automatically generated and folder names will differ from your qa/staging/live site to your local site.
There are some good reasons to use Yii's assets.
it prevents naming conflicts in css and js files
it allows you to keep CSS and JS files under your document-root but outside of your web-root (for easier version control)
it allows to easily switch between sets of CSS & JS files, rather than having to deal with each file individually (suppose the system admin needs to revert back to a previous version).
it allows you to publish assets (images, JS & CS) to several websites hosted on the same server.
Please check here or there for more details.
Well, when i started my first Yii project, i also put my CSS and JS files in assets. It works but then i found that its not just the right way. Its better to make a separate directory for your CSS file(s). Also there are some auto generated files in assets, so to avoid mix-up with those and your i prefer to make it separate. Hope you got the point.