<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -10,5 +10,17 @@ Merb::Plugins.config[:asset_helpers] = {
     :max_hosts =&gt; 4,
     :asset_domain =&gt; &quot;assets%s&quot;,
     :domain =&gt; &quot;my-awesome-domain.com&quot;,
-    :use_ssl =&gt; false
+    :use_ssl =&gt; false,
+    
+    # Global prefix/suffix for css/js include tags, overridable in js_include_tag and css_include_tag
+    #
+    # :js_prefix =&gt; &quot;http://cdn.example.com&quot;
+    # require_js :application # =&gt; &quot;http://cdn.example.com/javascripts/application.js&quot;
+    #
+    # :js_suffix =&gt; &quot;_#{MyApp.version}&quot;
+    # require_js :application # =&gt; &quot;/javascripts/application_0.2.2.js&quot;
+    :js_prefix =&gt; nil,
+    :js_suffix =&gt; nil,
+    :css_prefix =&gt; nil,
+    :css_suffix =&gt; nil
   } if Merb::Plugins.config[:asset_helpers].nil?
\ No newline at end of file</diff>
      <filename>merb-assets/lib/merb-assets.rb</filename>
    </modified>
    <modified>
      <diff>@@ -407,6 +407,10 @@ module Merb
     # ==== Options
     # :bundle&lt;~to_s&gt;::
     #   The name of the bundle the scripts should be combined into.
+    # :prefix&lt;~to_s&gt;::
+    #   prefix to add to include tag, overrides any set in Merb::Plugins.config[:asset_helpers][:js_prefix]
+    # :suffix&lt;~to_s&gt;::
+    #   suffix to add to include tag, overrides any set in Merb::Plugins.config[:asset_helpers][:js_suffix]
     #
     # ==== Returns
     # String:: The JavaScript include tag(s).
@@ -426,12 +430,21 @@ module Merb
     #   # =&gt; &lt;script src=&quot;/javascripts/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
     #   #    &lt;script src=&quot;/javascripts/validation.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
     #
+    #   js_include_tag :application, :validation, :prefix =&gt; &quot;http://cdn.example.com&quot;
+    #   # =&gt; &lt;script src=&quot;http://cdn.example.com/javascripts/application.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+    #   #    &lt;script src=&quot;http://cdn.example.com/javascripts/validation.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+    #
+    #   js_include_tag :application, :validation, :suffix =&gt; &quot;.#{MyApp.version}&quot;
+    #   # =&gt; &lt;script src=&quot;/javascripts/application.1.0.3.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+    #   #    &lt;script src=&quot;/javascripts/validation.1.0.3.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
     def js_include_tag(*scripts)
       options = scripts.last.is_a?(Hash) ? scripts.pop : {}
       return nil if scripts.empty?
       
       reload = options[:reload] || Merb::Config[:reload_templates]
-
+      js_prefix = options[:prefix] || Merb::Plugins.config[:asset_helpers][:js_prefix]
+      js_suffix = options[:suffix] || Merb::Plugins.config[:asset_helpers][:js_suffix]
+      
       if (bundle_name = options[:bundle]) &amp;&amp; Merb::Assets.bundle? &amp;&amp; scripts.size &gt; 1
         bundler = Merb::Assets::JavascriptAssetBundler.new(bundle_name, *scripts)
         bundled_asset = bundler.bundle!
@@ -441,7 +454,13 @@ module Merb
       tags = &quot;&quot;
 
       for script in scripts
-        src = asset_path(:javascript, script)
+        src = js_prefix.to_s + asset_path(:javascript, script)
+        
+        if js_suffix
+          ext_length = ASSET_FILE_EXTENSIONS[:javascript].length + 1
+          src.insert(-ext_length,js_suffix)
+        end
+        
         src += src.include?('?') ? &quot;&amp;#{random_query_string}&quot; : &quot;?#{random_query_string}&quot; if reload
         attrs = {
           :src =&gt; src,
@@ -464,6 +483,10 @@ module Merb
     #   The name of the bundle the stylesheets should be combined into.
     # :media&lt;~to_s&gt;::
     #   The media attribute for the generated link element. Defaults to :all.
+    # :prefix&lt;~to_s&gt;::
+    #   prefix to add to include tag, overrides any set in Merb::Plugins.config[:asset_helpers][:css_prefix]
+    # :suffix&lt;~to_s&gt;::
+    #   suffix to add to include tag, overrides any set in Merb::Plugins.config[:asset_helpers][:css_suffix]
     #
     # ==== Returns
     # String:: The CSS include tag(s).
@@ -488,11 +511,19 @@ module Merb
     #
     #  css_include_tag :style, :charset =&gt; 'iso-8859-1'
     #  # =&gt; &lt;link href=&quot;/stylesheets/style.css&quot; media=&quot;print&quot; rel=&quot;Stylesheet&quot; type=&quot;text/css&quot; charset=&quot;iso-8859-1&quot; /&gt;
+    #
+    #  css_include_tag :style, :prefix =&gt; &quot;http://static.example.com&quot;
+    #  # =&gt; &lt;link href=&quot;http://static.example.com/stylesheets/style.css&quot; media=&quot;print&quot; rel=&quot;Stylesheet&quot; type=&quot;text/css&quot; /&gt;
+    #
+    #  css_include_tag :style, :suffix =&gt; &quot;.#{MyApp.version}&quot;
+    #  # =&gt; &lt;link href=&quot;/stylesheets/style.1.0.0.css&quot; media=&quot;print&quot; rel=&quot;Stylesheet&quot; type=&quot;text/css&quot; /&gt;
     def css_include_tag(*stylesheets)
       options = stylesheets.last.is_a?(Hash) ? stylesheets.pop : {}
       return nil if stylesheets.empty?
 
       reload = options[:reload] || Merb::Config[:reload_templates]
+      css_prefix = options[:prefix] || Merb::Plugins.config[:asset_helpers][:css_prefix]
+      css_suffix = options[:suffix] || Merb::Plugins.config[:asset_helpers][:css_suffix]
 
       if (bundle_name = options[:bundle]) &amp;&amp; Merb::Assets.bundle? &amp;&amp; stylesheets.size &gt; 1
         bundler = Merb::Assets::StylesheetAssetBundler.new(bundle_name, *stylesheets)
@@ -503,7 +534,13 @@ module Merb
       tags = &quot;&quot;
 
       for stylesheet in stylesheets
-        href = asset_path(:stylesheet, stylesheet)
+        href = css_prefix.to_s + asset_path(:stylesheet, stylesheet)
+        
+        if css_suffix
+          ext_length = ASSET_FILE_EXTENSIONS[:stylesheet].length + 1
+          href.insert(-ext_length,css_suffix)
+        end
+        
         href += href.include?('?') ? &quot;&amp;#{random_query_string}&quot; : &quot;?#{random_query_string}&quot; if reload
         attrs = {
           :href =&gt; href,</diff>
      <filename>merb-assets/lib/merb-assets/assets_mixin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -271,4 +271,34 @@ describe &quot;External JavaScript and Stylesheets&quot; do
     result.should match(%r{/stylesheets/style.css})
     result.should match(%r{/stylesheets/layout.css})
   end
+  
+  it 'should create a js include tag with a prefix' do
+    result = js_include_tag('jquery.js', :effects, :prefix =&gt; &quot;http://cdn.example.com&quot;)
+    result.scan(/&lt;script/).should have(2).things
+    result.should match(%r{http://cdn.example.com/javascripts/jquery.js})
+    result.should match(%r{http://cdn.example.com/javascripts/effects.js})
+  end
+
+  it 'should create a js include tag with a suffix' do
+    @js_version = &quot;3.0.1&quot;
+    result = js_include_tag('jquery.js', :effects, :suffix =&gt; &quot;.#{@js_version}&quot;)
+    result.scan(/&lt;script/).should have(2).things
+    result.should match(%r{/javascripts/jquery.3.0.1.js})
+    result.should match(%r{/javascripts/effects.3.0.1.js})
+  end
+
+  it 'should create a css include tag with a prefix' do
+    result = css_include_tag('style.css', :layout, :prefix =&gt; &quot;http://cdn.example.com&quot;)
+    result.scan(/&lt;link/).should have(2).things
+    result.should match(%r{http://cdn.example.com/stylesheets/style.css})
+    result.should match(%r{http://cdn.example.com/stylesheets/layout.css})
+  end
+
+  it 'should create a css include tag with a suffix' do
+    @css_version = &quot;0.1.3&quot;
+    result = css_include_tag('style.css', :layout, :suffix =&gt; &quot;.#{@css_version}&quot;)
+    result.scan(/&lt;link/).should have(2).things
+    result.should match(%r{/stylesheets/style.0.1.3.css})
+    result.should match(%r{/stylesheets/layout.0.1.3.css})
+  end
 end</diff>
      <filename>merb-assets/spec/merb-assets_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>65a6e7f0a14ccfb1cad8f5d3f0940911e442b914</id>
    </parent>
  </parents>
  <author>
    <name>Cory ODaniel</name>
    <login>coryodaniel</login>
    <email>github@coryodaniel.com</email>
  </author>
  <url>http://github.com/wycats/merb/commit/9226ab290ff9ddf70aff0296b80960c5c47ecc93</url>
  <id>9226ab290ff9ddf70aff0296b80960c5c47ecc93</id>
  <committed-date>2009-02-25T10:35:00-08:00</committed-date>
  <authored-date>2009-02-23T20:19:18-08:00</authored-date>
  <message>added prefix and suffix options for js_include_tag and css_include tag.

Also defaults are available in Merb::Plugins.config or set on a case by case
basis in js_include_tag or css_include_tag

These are good for versioning js/css file file names (to force updates) and
for hosting statics on anotehr domain like cdn.example.com</message>
  <tree>2468b0179f6b429d9a4e3638398851e99e20a073</tree>
  <committer>
    <name>Matt Aimonetti</name>
    <login>mattetti</login>
    <email>mattaimonetti@gmail.com</email>
  </committer>
</commit>
