PhpStorm 2021.2 Help

Liquid

PhpStorm supports the Liquid template language and includes the following capabilities:

Install and enable the Liquid plugin

Before working with the Liquid template language in PhpStorm, make sure that the Liquid plugin is installed and enabled.

Supported file types

PhpStorm supports Liquid syntax for the following file types:

  • *.liquid files (processed as HTML files with Liquid code)

  • *.html.liquid, *.md.liquid, *.css.liquid, and so on

Create a Liquid file

To create a new Liquid file in PhpStorm, follow the steps below:

  1. Open the Project view Alt+1 and select the desired directory.

  2. From the main menu, select File | New| Liquid File. As an alternative, press Alt+Insert and select Liquid File in the New list.

  3. Specify the filename and press Enter.

Live templates

You can use live templates to insert Liquid code constructs into your code, such as if blocks, assign tags, and so on.

Expand a live template

To expand a live template, type the corresponding template abbreviation and press Tab. Let's see how to insert the if block using the predefined if template.

Insert if block using a template
  1. In a Liquid file, type if and press Tab.

  2. Specify the required condition and press Tab to move to the next statement.

  3. Type the desired code for the specified condition.

Configure live templates

To configure Liquid-specific live templates:

  1. Open Settings/Preferences Ctrl+Alt+S.

  2. Go to the Editor | Live Templates page and select the desired template in the Liquid group. You can learn how to configure live templates from Live templates.

Configure code style settings

To customize code style settings for Liquid:

  • Press Ctrl+Alt+S to open the IDE settings and select Editor | Code Style | Liquid.

Configure syntax highlighting

You can configure Liquid-aware syntax highlighting according to your preferences and habits.

  1. In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Color Scheme | Liquid.

  2. Select the color scheme, accept the highlighting settings inherited from the defaults or customize them as described in Colors and fonts.

Last modified: 11 October 2021