I wrote an article about how i manage css files for my website, perhaps
you want to read it ;)
http://www.chris.lu/en/news/show/4d5af902e7fbd/
chris
Am 12.02.2011 01:06, schrieb Joe Balancio:
> Thanks for the links. I'll definitely add the minify stuff.
>
> About this page: http://devzone.zend.com/article/11760
> I like how simple and elegant the solution is to include js/css by
> controller and action. However, what if I have the same js that needs to be
> included in two different actions or two different controllers?
>
> In the comments of the above page, I found:
> http://www.devpatch.com/2010/02/view-plugin/
> I like what this person is saying, "In my approach loading up different
> CSS/JS files per controller is the exception not the rule." Basically, have
> your global stuff, but treat it controller-specific and action-specific
> CSS/JS on a per-case basis (as needed). This is the solution my project is
> using, but if I'm managing several controllers and several actions, it will
> start to get messy and difficult to manage how all the different files are
> included.
>
> The idea I had in mind:
> CSS/JS will be managed through configuration (XML). CSS/JS will be targeted
> through routes and it will follow the same layout as the route
> configuration. Create a concept of bundles which are groups of CSS/JS that
> can be assigned to a route. Create concept of a global which will be
> included on every page. Create concept of templates from which routes will
> be allowed to inherit. A plugin will be responsible for including (and
> minifying) js/css based on the configuration.
>
> Sample XML:
> <global>
> <js>
> <jquery>/js/jquery.js</jquery>
> </js>
> <css>
> <main>/css/main.css</main>
> </css
> </global>
>
> <about-route>
> <css>
> <about>/css/about.css</about>
> </css>
> <js>
> <about>/js/about.js</about>
> </js
> </about-route>
>
> -----
> - Joe
没有评论:
发表评论