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 6886693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:47:29+00:00 2026-05-27T05:47:29+00:00

A template engine (Velocity, FreeMaker, etc.) lets you, among other things, split up your

  • 0

A template engine (Velocity, FreeMaker, etc.) lets you, among other things, split up your HTML into re-usable chunks. E.g. you have a <div> showing an ad that appears on lots of places in your site – you can compose a file containing that <div> and its contents once (with Velocity: a ‘myAd.vm’ file), and load it up into whatever page necessary (with Velocity: apply #parse('myAd.vm').

I like to think of these .vm files as functions, they get “invoked” (parsed) and spit out textual content. They can have “parameters” – in Velocity you can #set( $myParam = 'foo' ) just before parsing the ‘myAd.vm’ file, and use that variable inside that file.

My question is: How does the proper way of defining CSS and Javascript in their own files fit in with that?

The ‘myAd.vm’ needs CSS styling, you can define that CSS in that file itself with a <style> tag – which will result in an HTML document with a style tag in its <body> – not in its <head>, and certainly not in a separate file.

Or, you could define the CSS that ‘myAd.vm’ needs in a separate ‘myAd.css’ file, and demand that whatever HTML document that parses ‘myAd.vm’ will have a <LINK REL="StyleSheet" HREF="myAd.css" TYPE="text/css"> in its head tag. This is a problem since it makes things more complex and cumbersome, and – you may want to actually parse the ‘myAd.vm’ file depending on a conditional (in Velocity, for example, you could have #if(someCondition) #parse('myAd.vm') #end) – meaning you don’t actually know in advance whether the head tag should link to that external CSS file.

Any thoughts?
Thanks.

  • 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-27T05:47:29+00:00Added an answer on May 27, 2026 at 5:47 am

    Most frameworks that ive used give you the ability to make some kind of function call that kind of acts as an include for a css or js file, these are then output in the head to external files. In many casses i actually run all these through a minifier so in the end there is only one css and one js file.

    This way you can add to the asset stack from within view partials and put stuff directly in the head.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using velocity engine template for mailing in struts1 and hibernate configuration. I
Im searching a Template Lib or Template Engine for generating HTML (XML) that runs
Is there a template engine for Python 3? It should be flexible (not HTML/XML
I want to create a custom template engine like velocity or freemarker which will
I'm trying to decide between Freemarker and Velocity to use as a template engine,
I've been working with Apache's Velocity engine and a custom template. The thing is,
I am using velocity script engine , i have a xml template file which
I have my own template engine. It can converts variable like this: html html
I use XSLT as template engine in my PHP framework. HTML forms are in
I am looking for a template engine to use client side. I have been

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.