Stylesheet

Stylesheet

{{ stylesheet }}

Name Type Description
object_type String Will always be datastore_item
is_valid Boolean True if this references a published stylesheet
guid String The unique identifier for this stylesheet
value String Contains the same value as guid
name text The name of the stylesheet which, when combined together with the path, uniquely identifies the stylesheet on this site
path String The path, exluding filename, of this stylesheet used for organizational and reference purposes
stylesheet_type select Stylesheet language. May either be "css", "less", or "scss"
compiled Boolean If true, indicates that this is a top-level stylesheet that should be compiled
parse_liquid Boolean If true, indicates that this stylesheet contains Liquid Markup that should be rendered before the stylesheet is processed and output
url String The full URL for this stylesheet in the CDN
style_sheet_text code The source code for this stylesheet
style_sheet_text_compiled String The full processed and compiled stylesheet text if this is a compiled stylesheet
field_id String The identifier for this field
label String The label for this field
output String Adds the stylesheet to the document head, similar to calling {% add_stylesheet %} with it

{{ stylesheets }}

Contains multiple stylesheets.

Name Type Description
object_type String Will always be datastore_item
is_valid Boolean True if this contains at least one published stylesheet
output String The default output that the stylesheets will produce when it is output directly to the template - using the "output_in_list" property of each stylesheet in the items list
prepended list List containing any prepended stylesheets.
fetched list List containing all of the stylesheets that were fetched from the database (as opposed to prepended or appended).
appended list List containing any appended stylesheets.
appended_unique list List containing any appended stylesheets excluding any stylesheets that are in either the list of prepended or fetched stylesheets.
items list List containing all of the combined stylesheets from the prepended, fetched, and appended lists. If unique is true, this list will not contain any duplicates. If max_size is set, this list will not contain more than the number of stylesheets specified.
size Integer The total number of stylesheets in the items list, including prepended, fetched, and appended lists, and respecting the unique and max_size properties.
max_size Integer If set, this is the maximum number of items that will be returned in the items list and the maximum number of items that will be included when this stylesheets object is enumerated as a list. When not set, this value will be 0.
unique Boolean When true, the items list will not contain any duplicates. Only the first instance of each stylesheet will be included.
limit Integer The maximum number of items that were allowed to be in the list of fetched stylesheets. May be 0 in some cases (such as when when there are no fetched stylesheets.
start Integer The 1-based index of the first item in the list of fetched stylesheets.
page Integer The 1-based index of the paginated results returned in the list of fetched stylesheets, which is calculated from the start and limit parameters. Useful for paginated results.
total_count Integer The 1-based index of the first item in the list of fetched stylesheets
total_pages Integer

{% stylesheet %}

{% stylesheet output_to_template? [var, set, or assign]? variable? output_to_template? = value %}

{% stylesheet
output_to_template
 
If included the stylesheet will be output directly to the template.
var, set, or assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this stylesheet is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this stylesheet to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the stylesheet will be output directly to the template.
=
value
 
Should evaluate to a stylesheet object, or the name or guid of a stylesheet May use liquid filters.
%}
Fetches a single stylesheet.

{% stylesheets %}

{% stylesheets output_to_template? [var, set, or assign]? variable? output_to_template? = arguments %}

{% stylesheets
output_to_template
 
If included the stylesheets will be output directly to the template.
var, set, or assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this stylesheets is stored on. "var" is the default behavior.
variable
output_to_template
 
If included the stylesheets will be output directly to the template.
=
arguments
 
Key:value pairs. May use the variable arguments syntax.
%}

arguments

prepend
 
May be a single stylesheet, a list of stylesheets, or the name or guid of a stylesheet to be be included at the beginning of the stylesheets.
append
 
May be a single stylesheet, a list of stylesheets, or the name or guid of a stylesheet to be be included at the end of the stylesheets.
exclude
 
May be a single stylesheet, a list of stylesheets, or the name or guid of a stylesheet that should NOT be included in the fetched results. Has no affect on prepended or appended stylesheets.
exclude_prepended
 
True to specifically exclude all prepended stylesheets from the fetched results. If "unique:true" is specified this is the default behavior, although you may also specify "exclude_prepended:false" to allow any prepended items to be fetched along with other results anyway.
exclude_appended
 
True to specifically exclude all appended stylesheets from the fetched results. This is false by default - even if "unique:true" is specified - so that results are returned in the proper order.
unique
 
True to remove duplicates from each of the resulting lists (prepended, fetched, appended, and items), although there may be duplicates between the prepended, fetched, and appended lists. The "items" list will include objects in the order in which they appear - with prepended items first, then fetched items, then appended items.
max_size
 
The maximum number of items to be included in the "items" list. If there are any prepended or appended items, this will automatically lower the "limit" to only fetch as many stylesheets as needed. Note that this may also impact both the "page" and "total_pages" values in the resulting stylesheets. In order to use pagination with a list loaded using "max_size" use "start" instead of "page" and "limit".
stylesheet_type
 
Only include stylesheets of the given type
compiled
 
Only include stylesheets that either are or are not compiled
is_legacy
 
only include stylesheets that are marked as using a legacy compiler
path
 
May include multiple paths. Only include stylesheets with one of the given paths (excluding child paths)
date_created_start
 
Only include stylesheets with date_created greater than or equal to date_created_start. Remember that date_created will typically be the date that the stylesheet was first published.
date_created_end
 
Only include stylesheets with date_created less than or equal to date_created_end. Remember that date_created will typically be the date that the stylesheet was first published.
start
 
Set the 1-based index of the first stylesheet to fetch.
page
 
Used to automatically calculate the first stylesheet to fetch based on both the "limit" and the 1-based "page" value. Defaults to 1, but is ignored if "start" is set.
limit
 
The maximum number of stylesheets to fetch. Defaults to 10. Note that if "max_size" is defined, then "limit" may be automatically lowered even if specified separately.
sort_by
 
Specify which property to sort the results by. Has no affect on prepended or appended stylesheets. Options include:
  • date_created: the date each stylesheets was first published. Unpublishing and republishing a stylesheets resets date_created to the current date.
  • random: results will be returned in a random order, which prevents the page from being fast-cached. Setting cache_random:true overrides this behavior and allows the page to be fast-cached anyway.
  • name
  • title
  • url
  • browser_title
sort_direction
 
asc or desc.
cache_random
 
True to allow the results to be cached when sort_by is "random".
Fetches a list of stylesheets.

{% add_stylesheet %}

Add a stylesheet asset to the head of the current page via a <link> tag

{% add_stylesheet value attributes %}

{% add_stylesheet
value
attributes
 
Key:value pairs with unique keys. May use the variable arguments syntax. Additional attributes to include on the link tag. Attributes must have string values. "link" and "rel" are not allowed as they will always be set by this method.
%}

attributes

position
 
Where to output the stylesheet in the current page. May either be "head", "body", or "in_place". If "head", the stylesheet will be output inside the HTML head, if "body", the stylesheet will be output at the end of the 'body' tag. If "in_place", the stylesheet will be output immediately to the template. The default is "head", which typically results in the best browser performance.

{% add_stylesheet inline %}

Outputs an inline stylesheet in a <style> tag.

{% add_stylesheet inline [uniquename] [= attributes]? %}

{% add_stylesheet
inline
uniquename
 
If included, only one style tag will be included for each uniquename. This makes it safe to add an inline stylesheet in one or more partial templates which may be included multiple times in a page.
=
attributes
 
Key:value pairs with unique keys. May use the variable arguments syntax.
%}

attributes

position
 
Where to output the style tag in the current page. May either be "head", "body", or "in_place". If "head", the style tag will be output inside the HTML head, if "body", the style tag will be output at the end of the 'body' tag. If "in_place", the style/link tag will be output immediately to the template. The default is "head", which typically results in the best browser performance.
other
 
Additional attributes to include on the style tag (such as "media", "id", or "disabled"). Additional attributes must have string values

{% end_stylesheet %}

{% include %}

Processes and outputs a partial template, javascript, or stylesheet.

If the partial template is a compiled template, then any custom fields from the partial template will be available in the parent template as well.

{% include [template|javascript|stylesheet]? variable =? attributes? %}

{% include
type
 
Explicit type selector: template, javascript, or stylesheet. If not specified, the object to be included will be the same as the type of the current ojbect (in a template this will default to template, etc...).
variable
 
May be the template, javascript, or stylesheet object to include, the unique identifier for the object to include, or the relative or absolte path to the template, javascript, or stylesheet
=
attributes
 
Key:value pairs with unique keys. May use the variable arguments syntax. Variables to set on the created scope before the included object is processed
%}

The path is significant when including objects. Every template, javascript, and stylesheet has a path, even if that is the root path (/). The location of the path to be included will always be based off of the path of the current object. So including 'header' from a template at the path '/pages' will attempt to process '/pages/header' while the same include from a template at the root path - which would attempt to process '/header'.

You always have the option of using an "absolute path" when including templates by beginning your included template name with '/'. Eg: {% include '/header' %} or {% include '/partials/header' %}. Absolute paths ignore the path of the current template when determining what partial to include.

You can also navigate up the directory structure using '../'. So including '../partials/header' from a template at the path '/agency/pages' will attempt to process '/agency/partials/header'.