rajjaiswalsaumya / webutilities

Automatically exported from code.google.com/p/webutilities
0 stars 0 forks source link

Allow other extensions for JS / CSS files #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. We have a JSP which is used as a stylesheet and another JSP which produces 
the output for JS.
2. The webutilities do not process JSPs because they do not end with .js or .css

What is the expected output? What do you see instead?
Could you make the suffix of files which are processed configurable? Then we 
could use our JSPs and compress the content. Could you do the same with the 
mime type which is processed?

What version of the product are you using? On what operating system?
0.0.4

Please provide any additional information below.

Original issue reported on code.google.com by tribbel0...@googlemail.com on 12 Apr 2011 at 3:46

GoogleCodeExporter commented 8 years ago

Original comment by rr.patil...@gmail.com on 13 Apr 2011 at 4:24

GoogleCodeExporter commented 8 years ago
If you are asking for minifying JS, CSS (which is dynamically generated by 
JSPs) and also enabling gzip compression on them then it is doable. Whereas if 
you want multiple JSP files, which are generating JS to be merged using 
JSCSSMergeServlet that is not possible as of now. 

Q. How to minify JS, CSS contents which is dynamically generated by JSPs
A. Using minify tag. http://code.google.com/p/webutilities/wiki/YUIMinTag.
In your JSP files you can declare taglib as...
<%@ taglib uri="http://webutilities.googlecode.com/taglib/wu" prefix="wu" %>
And put your script code generation inside the minify tag
<wu:minify type="js">
        // your JSP code that generating JS   
</wu:minify>
Similarly for CSS 
wu:minify type="css">
        // your JSP code that generating CSS    
</wu:minify>

If you look view source of the output, you will see that your JS/CSS code is 
minified.

Q. How to serve that JSP generated JS/CSS with gzip encoding?
A. You already know the name/path of the JSPs that you are using for generating 
JS/CSS. You can add there pattern for CompressionFilter (if current pattern 
doesn't cover them). 
http://code.google.com/p/webutilities/wiki/CompressionFilter.

<filter-mapping>
   <filter-name>compressionFilter</filter-name>
   <url-pattern>*.js</url-pattern>
   <url-pattern>*.css</url-pattern>
   <url-pattern>javascriptGenerator.jsp</url-pattern> <!-- name of your JSP -->
   <url-pattern>stylesheetgenerator.jsp</url-pattern> <!-- name of your JSP -->
 </filter-mapping>

Original comment by rr.patil...@gmail.com on 14 Apr 2011 at 11:57

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi! Thanks - this looks like a proper solution. I thought about using the 
Minify filter for the entiry JSP. But you are right, it might be better only to 
specify certain areas within that JSP. I would use the same mechanism within 
the JSP that generates CSS.

The zipping of resources is done by the HTTP Server. This saves performance on 
the application server side.

Original comment by tribbel0...@googlemail.com on 15 Apr 2011 at 7:12

GoogleCodeExporter commented 8 years ago
Sure. Closing this issue as invalid. We don't need to support JSP or other 
extensions.

Original comment by rr.patil...@gmail.com on 15 Apr 2011 at 9:08