ColdFusion Bundler & Minification

I am looking for a package / minifier to use on my ColdFusion site. I searched for over an hour and found only the right plugin for cfWheels. Unfortunately, we are tied to framework-one at this stage, so we cannot use this plugin.

Can anyone recommend a tool to link and minimize our js / css with ColdFusion FW1?

I am thinking of โ€œborrowingโ€ from the asp.net System.Web.Optimization bundler, but it just seems superfluous to me.

Thanks!

+6
source share
1 answer

We recently made this decision. In the end, we decided to use Gulp, which is the Javascript-based runner that you use in development, and my recommendation is that you do the same. Gulp has a huge community and user base and many plugins. It can view files for changes as they are developed and automatically re-concatenate, minimize (and about 1000 other things - see http://gulpjs.com/plugins/ ).

Using the Gulp plugin named gulp -rev, files are automatically renamed, for example file-k34jzkl3.css, to override browser caches when changes are made. Using another Gulp plugin, gulp -manifest, we automatically create a JSON file that maps the original CSS file to the cached name (for example, "file.css": "file-k34jzkl3.css"), and then we have a simple CFC that translates these names to the right place in our HTML. Here's what our explicit JSON file looks like:

{ "baseline.css": "/global/baseline-82bcd2ab92.css", "user.css": "/global/user-0d1d32170c.css" } 

And then our CFML markup looks like this:

 <link rel="stylesheet" href="#application.asset.getAsset("baseline.css")#"> 

What generates HTML output, for example:

 <link rel="stylesheet" href="/global/baseline-82bcd2ab92.css"> 

I created a repo with the code https://github.com/ghidinelli/assets.cfc

+4
source

Source: https://habr.com/ru/post/977009/


All Articles