Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Minification and Componentize multiple CSS and JS files

 
Charles Sexton
Ranch Hand
Posts: 272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was curious if anyone in the class knew of any tools, libraries, frameworks within Java EE that will minify and componentize (if thats a word) multiple css and js files.

For example: lets say you have a login.css and a index.css. You want to keep these separate to make them more modularized/componentized. The minification will remove any white space and try to compile everything to as less lines as possible for faster transmission of files. For example jquery.min.js is a minified version of jquery.

I get this idea from Angular.js. Angular is a very component based framework. Example, you would have a login component and the login component would have its own html, css and js files. The components are combined to build a single page which could be the main page of your website. I like this design as for large web applications it makes it easier to maintain different components of a web application. Plus it is also loosely coupled as its very easy to remove and add components throughout the web application. Component based web applications are becoming very much the future.

This approach is good if you have several components within an application. Login is just an example but you could very well have a slider or carousel component. The amount of components is completely dependent on the web application needs but its provides a more robust solution for web applications.

CSS Tricks intro to web components
https://css-tricks.com/modular-future-web-components/


In jsp you can include multiple html segments into specific jsp files using include.

Includes at compile time for dynamic data


Includes at runtime


I am curious on how to separate the css and js files in Java EE. Minify not necessary a requirement because you can always do this manually for the production environment but would be a plus if the tool, library or framework was able to do this.
 
Charles Sexton
Ranch Hand
Posts: 272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does spring MVC or GWT allow you for example create a component such as


directory structure example
 
Charles Sexton
Ranch Hand
Posts: 272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic