liquid

Ignore parts of sass file for parsing

◇◆丶佛笑我妖孽 提交于 2019-12-05 22:19:43
问题 I'm trying to get SASS to ignore part of my .scss code while parsing. It's for a shopify theme that I'm making. My scss files are compiled into .css.liquid files so that I can put shopify's templating language liquid into the css too. I want the compiled css.liquid to look like this: .header--logo { background: url({{ 'header-logo.png' | asset_url }}) 0 0 no-repeat; } In LESS I used to do this: .header--logo { background: ~"{{ 'header-logo.png' | asset_url }}" 0 0 no-repeat; } Does SASS also

Can the Liquid Ruby template engine deal with Rails forms?

社会主义新天地 提交于 2019-12-05 19:57:29
I've been searching for a template engine to allow users to create lessons and exercises online easily. Seems like Liquid is the most popular for use in Rails. Can Liquid users easily create rails forms? Normally I create forms in ERB with: <%= form_for(@lesson) do |f| %> <% if @lesson.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@lesson.errors.count, "error") %> prohibited this lesson from being saved:</h2> <ul> <% @lesson.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <div>lots of fields</div> <% end %> Rails will automatically

Jekyll site.categories.{{variable}}?

拈花ヽ惹草 提交于 2019-12-05 15:23:15
问题 I want to make an archive page with the example generator from the Jekyll documentation. The generator works fine but I don't know to implement the layout correctly. I am using the following file so far: {% assign cat = page.category %} <div class="category-archive"> <div> <span class="title">Category archive for {{ cat }}</span> </div> <div> {{ cat }} <ul class="posts"> {% for post in site.categories.cat %} <li><span>{{ post.date | date_to_string }} - </span> <a href="{{ post.url }}">{{ post

Using JS to find screen height, then apply it to a div class through CSS

主宰稳场 提交于 2019-12-05 14:30:02
I'm working on a single-page scroll-to webdesign, and can't get this code to work. What I'm trying to do is get the screen height of the user through JavaScript. Then I want to apply this screen height to my div class, so that I'll always have a container that is the size of the users screen resolution. A liquid design that always fits the screen, so to speak. Here's a short example of where I want the variable screen height to be: <script type="text/javascript"> function matchHeight() { $('.container').css('height',$(window).height); }; </script> <div class="container"> I want this container

How to render Handlebars markup from a Liquid template (Jekyll)

允我心安 提交于 2019-12-05 13:38:45
问题 I am using Jekyll for our blog and rendering Handlebars templates is a pain. We have to escape like so: {% highlight html %} <div>{{"{{code"}}}}</div> {% endhighlight %} It's fugly. Is there an easier way to do this? 回答1: I found the answer: {% highlight html %} {% raw %} <div>{{code}}</div> {% endraw %} {% endhighlight %} 来源: https://stackoverflow.com/questions/14209942/how-to-render-handlebars-markup-from-a-liquid-template-jekyll

Jekyll, Liquid - Get all pages from category from page

泪湿孤枕 提交于 2019-12-05 11:05:54
I have a question in Jekyll Liquid. I have layout, where I want to show pages from category. To show category I use page.categories variable. When I show in bracket {{page.categories}} is correct. but I don't know, how to pass to loop? {% for post in site.categories[page.categories] %} <li><a href="{{ post.url }}">{{ post.title }}</a></li> {% endfor %} {% for post in site.categories[{{page.categories}}] %} <li><a href="{{ post.url }}">{{ post.title }}</a></li> {% endfor %} Don't work. If I passed explicite: {% for post in site.categories['cat1'] %} <li><a href="{{ post.url }}">{{ post.title }}

how can i create this gallery more efficiently using jekyll & liquid?

狂风中的少年 提交于 2019-12-05 05:35:45
问题 I have gallery is based on my twitter bootstrap css files. I ended up using Kramdown with inline HTML+Markdown because I couldnt get it to work in Liquid the way I had hoped. The markdown template parsed by Kramdown looks like this: --- layout: gallery title: Gallery group: dropnavigation root: .\ --- {% include root %} {::options parse_block_html="true" /} <li class="span3"> <div class="thumbnail"> [![image](http://placehold.it/260x180)](#) #####Thumbnail label Thumbnail caption right here..

DotLiquid/Liquid access to dictionary

家住魔仙堡 提交于 2019-12-05 01:06:00
问题 I am using DotLiquid template engine and trying access dictionary value in template. I have passed to template this drop: public class SomeDrop : Drop { public Dictionary<string, object> MyDictionary {get; set;} } var someDropInstance = SomeDrop { MyDictionary = new Dictionary<string, object> {{"myKey", 1}} } Template.NamingConvention = new CSharpNamingConvention(); var preparedTemplate = Template.Parse(template); var templateOutput = preparedTemplate.Render(Hash.FromAnonymousObject(new {

Check for existence of file using Jekyll

有些话、适合烂在心里 提交于 2019-12-05 00:43:58
How can I use Jekyll to test for the existence of a file? To clarify, I want to run an {% if %} statement to check if an image file exists with the same name as the page I am on. On my page in the YAML front matter: ---- reference-design: true ---- In my layout: {% if page.reference-design %} {% assign filename = page.path | remove_first: '.html' %} <!-- How can I check if file actually exists? --> <img src="images/reference_designs/{{ filename }}.png"> {% endif %} As of Jekyll 2, all site files are available via site.static_files . You can use this to check if a file exists. For example: {%

Liquid Template Map Filter

六眼飞鱼酱① 提交于 2019-12-04 22:12:32
问题 How, exactly does one use the map filter in Liquid? I'm using it in Jekyll. --- my_array: [apple, banana, orage] my_map: hello: world foo: bar my_string: "how does this work?" --- {{ page.my_map | map ... }} That's about where I get lost. I cannot seem to find any example of its usage in the docs or anywhere else online for that matter. By the way, I do not know Ruby, yet, so the source code is not clear to me, either. From the filter tests it looks like the following should produce something