What should I make use of to instantly incorporate css/js documents?

I'm mindful of sprockets for incorporating javascript documents, yet have not attempted it. What are a few other alternatives and also just how do they accumulate?

0
2019-05-07 02:19:05
Source Share
Answers: 7

I have actually currently resolved this concern in another question

In knowledge, I need to have asked it on Webmasters as opposed to the Programmers website.

You have 3 alternatives:

  1. Let your structure manage it instantly
  2. Let your webserver manage it instantly
  3. Roll your very own alternative to do it by hand

Option 1 (making use of a CakePHP expansion):

Download and also install AssetPacker right into your website (which additionally calls for jsmin and also CSSTidy). Change your a couple of lines of resource that include the js documents. Clean - > Rinse - > Repeat. Voila, the remainder is done instantly for you.

If you make use of a few other structure, opportunities are, there is a device that will certainly complete this for you. It is a rather usual need in the webdev globe.

Alternative 2 (making use of an Apache mod):

Take an appearance at the Google Pagespeed mod for Apache. It does every little thing you define and also a great deal even more.

Make certain to check your manufacturing web server is sources though. Some individuals have actually been seeing concerns where this raises load on their web server laid-up. I'm negative yet it might call for an enough fixed web content approach to be a reliable alternative.

Alternative 3:

If you actually desire, you can create some PHP magic that concatenates JS documents web server side and also incorporates all the link rel enjoys one yet ... That is specifically what both approaches are currently doing anyhow.

Directly, I 'd highly discourage this alternative.


Regarding I recognize Sprockets concatenates JS submits the like AssetPacker, it is simply applied as a Ruby Gem. What it does not do is minify the js code. So, if you utilize it, it is possibly an excellent suggestion to order the jsmin treasure also. For information on how to use Sprockets + JSMin in CakePHP check this out.

I recognize I place focus on CakePHP yet ... I'm thinking that, if a plugin can be adjusted to CakePHP, it needs to be unimportant to adjust it to a various structure also.

0
2019-05-30 14:15:28
Source

I created a trainer for Asp.Net that makes use of YUI to compress, concatenate, and also caches the result.

Below's the resource : http://gist.github.com/130913

0
2019-05-09 07:54:03
Source

For ASP.NET tasks, I have actually made it a component of my construct procedure based upon instructions by Karl Seguin.

Karl defines it ideal on his blog, yet the brief variation is to set up a console application covering YUICompressor. After that you can set up a blog post - construct job to call that console application versus the area of the JS documents in your website.

0
2019-05-09 07:52:05
Source

A fast google search locates this to incorporate CSS documents : http://www.tothepc.com/archives/combine-merge-multiple-css-files/

0
2019-05-08 23:37:19
Source

Are you certain that you intend to incorporate them? If you make use of an usual collection, you can utilize a CDN to supply your javascripts. You can after that capitalize on internet browser caching (thinking various other websites are making use of the very same CDN) and also dispersed distribution. Microsoft and also Google each have remedies (I have not truthfully made use of either, yet I am absolutely mosting likely to start) and also there might be others.

0
2019-05-08 23:33:34
Source

For this recognizing Python could in fact serve. You can find out Python rather promptly. I began concerning 2 weeks earlier and also my first application (which still isn't ended up) is mosting likely to do the specific very same point you desire. Like the DotLess compiler it will certainly have a watch function that will certainly consider documents or directory sites and also if they transform it will certainly create a new documents.

Python is additionally wonderful for various other upkeep jobs and also I read a great deal of system adminsitrators like to utilize it.

0
2019-05-08 20:51:02
Source

If your webapp remains in PHP you need to take into consideration making use of minify :

It incorporates numerous CSS or Javascript documents, gets rid of unneeded whitespace and also remarks, and also offers them with gzip encoding and also optimum client-side cache headers.

0
2019-05-08 02:57:37
Source