Loading Rakefile +11 −6 Original line number Diff line number Diff line Loading @@ -94,6 +94,14 @@ def combine_js(html, dir) html.sub(js_section_re, '<script type="text/javascript" src="app.js"></script>') end # Modifies HTML to link app.css. # Doesn't modify the linked CSS files. def rewrite_css_links(dir, filename) html = IO.read(dir + "/" + filename); html = combine_css(html, dir, :replace_html_only) File.open(dir + "/" + filename, 'w') {|f| f.write(html) } end # Compress JavaScript and CSS files of JSDuck def compress load_sdk_vars Loading @@ -118,12 +126,9 @@ def compress # Remove the entire app/ dir system("rm", "-r", "#{dir}/app") # Concatenate CSS in print-template.html file print_template = "#{dir}/print-template.html"; html = IO.read(print_template); # Just modify HTML to link app.css, don't write files. html = combine_css(html, dir, :replace_html_only) File.open(print_template, 'w') {|f| f.write(html) } # Change CSS links in print-template.html and index-template.html files rewrite_css_links(dir, "print-template.html") rewrite_css_links(dir, "index-template.html") # Concatenate CSS and JS files referenced in template.html file template_html = "#{dir}/template.html" Loading Loading
Rakefile +11 −6 Original line number Diff line number Diff line Loading @@ -94,6 +94,14 @@ def combine_js(html, dir) html.sub(js_section_re, '<script type="text/javascript" src="app.js"></script>') end # Modifies HTML to link app.css. # Doesn't modify the linked CSS files. def rewrite_css_links(dir, filename) html = IO.read(dir + "/" + filename); html = combine_css(html, dir, :replace_html_only) File.open(dir + "/" + filename, 'w') {|f| f.write(html) } end # Compress JavaScript and CSS files of JSDuck def compress load_sdk_vars Loading @@ -118,12 +126,9 @@ def compress # Remove the entire app/ dir system("rm", "-r", "#{dir}/app") # Concatenate CSS in print-template.html file print_template = "#{dir}/print-template.html"; html = IO.read(print_template); # Just modify HTML to link app.css, don't write files. html = combine_css(html, dir, :replace_html_only) File.open(print_template, 'w') {|f| f.write(html) } # Change CSS links in print-template.html and index-template.html files rewrite_css_links(dir, "print-template.html") rewrite_css_links(dir, "index-template.html") # Concatenate CSS and JS files referenced in template.html file template_html = "#{dir}/template.html" Loading