How do I use Jammit with EJS javascript templates? - jammit

Has anyone used Jammit with EJS javascript templates? I can't figure out how I should load a new template with jammit. It's causing me caching issues.
Here is how you would normally load a template. Not sure how I would do it using Jammit.
http://code.google.com/p/embeddedjavascript/wiki/Templates
html = new EJS({url: '/template.ejs'}).render(data)

Related

How to minify html with laravel mix

I use laravel 5.6 in my project.
For example: I need minify index.php with laravel mix.
I used to work with Laravel-Elixir.
How to minify HTML with laravel mix ?
https://github.com/mercuryseries/laravel-elixir-minify-html
This package allows you to minify your static HTML files or the HTML that gets generated by your Blade template files.
Enjoy !

Is there a way in Total.js to add to #{head} from a view?

I'm using total.js and wanting to add a page-specific CSS link tag to a page's HTML <head> from within a view, rather than coding it into the route's controller.
I've tried to use #(head(css('page.css'))} but that results in a server error. Using #{css('page.css')} prints out the CSS link tag as part of the #{body}. Yet, the #{meta('Page Title')} directive is able to direct its output to the <head> section of the page.
Am I missing something or is it just not possible in this version of total.js?
Try to add #{head('/css/page.css')}.

Overwrite template's stylesheet with the one from custom component in Joomla

In my custom Joomla 3 extension I am using Bootstrap 2.3.2 for the front-end. I noticed that the default Joomla template protostar overwrites default Bootstrap classes which is not what I would like. Is there a way to load my stylesheet after the template's stylesheets so they overwrite any common rules may exist?
Try something like this,
This will add the css at your component calling time inside the component HTML section . Keep in mind it will not add the css at head section but for sure it will appear after the template css
$stylelink = '<link rel="stylesheet" href="../css/css.css" />';
$document = JFactory::getDocument();
$document->addCustomTag($stylelink);
Hope it works..

How to use version.rb plugin in Jekyll static site generator

Here is the plugin code...
module Jekyll
module VersionFilter
def versioned_url(input)
"#{input}?#{Time.now.to_i}"
end
end
end
Liquid::Template.register_filter(Jekyll::VersionFilter)
I am trying to cache bust/version control my .css file. I am new to Liquid. I am having trouble figuring out this basic plugin. Any help?
You need to put version.rb into the _plugins/ directory in the root of your Jekyll site. If you don't have a _plugins/ directory, create one.
For usage - it looks like it gives a new filter that you can apply to text - so you'd use it in your templates to filter the references to your CSS files, adding the query string so that they aren't cached - but I'm sure there's more info on that wherever you got the code from.
For what it's worth, breaking caches with querystrings isn't the best solution. It'd probably be better to write a plugin that adds a new string to the actual filename, and then adds that string to the urls where those assets are included in the templates - but that is a bit more complex.
If using an existing plugin for static asset versioning is an option for you, try jekyll-minibundle.
Assuming you keep non-stamped CSS files in _styles (note the _, because you don't want these to be exported to the production site) and want the stamped CSS files to appear in css, do the following:
<link href="{% ministamp _styles/site.css css/site.css %}" rel="stylesheet" media="screen, projection">
That works fine in combination with compass, just make compass export to _styles.

include external content in a mvc3 razor

How to include external content in a mvc3 razor ?
I want to include some external website as it is done by php include.
I will use it in a custom helper
#helper myHelper(){}
You could use an <iframe> to include an external website as part of your site if this external website doesn't provide some integration API that you could use. Another possibility if this external website doesn't depend on CSS and Javascript is to send an HTTP request to it in your controller and fetch the resulting HTML that you could embed in your partial. Of course you might need to strip the unnecessary <head> and <body> tags from the HTML that might interfere with yours.

Resources