Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 833295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:29:44+00:00 2026-05-15T04:29:44+00:00

I’m writing a webapp using Zend framework and a homebrew widget system. Every widget

  • 0

I’m writing a webapp using Zend framework and a homebrew widget system. Every widget has a controller and can choose to render one of many views if it chooses. This really helps us modularize and reconfigure and reuse the widgets anywhere on the site.

The Problem is that the views of each widget contain their own JS and CSS code, which leads to very messy HTML code when the whole page is put together. You get pockets of style and script tags everywhere. This is bad for a lot of different reasons as I’m sure you know, but it has a profound effect on our SEO as well.

Several solutions that I’ve been able to come up with:

  1. Separate the CSS and JS of every view of every widget into its own file – this has serious drawbacks for load times (many more resources have to be loaded separately) and it makes coding very difficult as now you have to have 3-4 files open just to edit a widget.

  2. combine the all the widget CSS into a single file (same with JS) – would also lead to a massive load when someone enters the site, mixes up the CSS and the JS for all widgets so it’s harder to keep track of them, and other problems that I’m sure you can think of.

  3. Create a system that uses method 1 (separate CSS and JS for every widget), when delivering the page, stitches all CSS and JS together. This obviously needs more processing time and of course the creation of such a system, etc.

My Question is what you guys think of these solutions or if there are pre-existing solutions that you know of (or any tech that might help) solve this problem. I really appreciate all of your thoughts and comments!!

Thanks guys,

Ali

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:29:45+00:00Added an answer on May 15, 2026 at 4:29 am

    I would definitely go for the third method. You get the flexibility of separation described in the first method, but you gain the ability to finetune the performance of your application (as pointed out by Pointy ..).

    All you need is some central registry system (a class) which you use to keep track of what stylesheets need to be loaded.

    Styles::add_sheet('widget_1.css');
    

    In addition, you could add a trigger (a method) to this class so that the code which handles the caching can track if the concatenated stylesheet needs to be rebuild.

    if (Styles::cache_needs_update()) {
      // rebuild (concatenate) stylesheet and save in cache
    }
    

    To go even further, one could also concatenate stylesheets by module or some other kind of grouping criterium. When there’s a lot of stylesheets (or js files) these concatenated groups of stylesheets can then be cached separately.

    The above code samples would become something like

    Styles::add_sheet('widget_1.css','group_name');
    
    if (Styles::cache_needs_update('group_name')) {
      // rebuild (concatenate) stylesheet for this 'group_name' and save in cache
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 411k
  • Answers 411k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It seems you have a value on Sender.aspx that you… May 15, 2026 at 7:43 am
  • Editorial Team
    Editorial Team added an answer Many options here, simplist is as follows: Connect to db… May 15, 2026 at 7:43 am
  • Editorial Team
    Editorial Team added an answer Probably the easiest way to do something like this is… May 15, 2026 at 7:43 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.