2

I have a website that was originally created as a one page application that is now morphing into a full (multi-page) site. I am trying to refactor the various design elements for reuse on the other pages. Not all pages have the same elements. What would be the best way to do this:

  1. put the code for each element in a separate file (in "designElements" folder?)and include directly on the pages that I would like it to appear. (Obviously not an option if there are any parameters that need to be passed)

  2. make one large "designElements" file a function for each element. Include the file once and then call the function when I want to use an element

  3. create separate files for each element, but wrap the code in a function, so that when I want to use an element I include that file and then call the function.

  4. Something else?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.