Close [x]

Create symlinks to LESS files

Edit this page on GitHub

Contents

First steps

  1. Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.

    If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:

    su <Magento file system owner> -s /bin/bash -c <command>
    
  2. To run Magento commands from any directory, add <your Magento install dir>/bin to your system PATH.

    Because shells have differing syntax, consult a reference like unix.stackexchange.com.

    bash shell example for CentOS:

    export PATH=$PATH:/var/www/html/magento2/bin
    

You can also run the commands in the following ways:

  • cd <your Magento install dir>/bin and run them as ./magento <command name>
  • php <your Magento install dir>/bin/magento <command name>

<your Magento install dir> is a subdirectory of your web server's docroot. Need help locating the docroot? Click here.

In addition to the command arguments discussed here, see Common arguments.

Create LESS files

This command enables you to create symlinks to LESS files.

Command options:

magento dev:source-theme:deploy less <file> [--locale="<locale>" ... "<locale>"] [--area="{adminhtml|frontend}"] [--theme="<theme name>" ... 
"<theme name>"] 

The following table discusses the meanings of this command鈥檚 parameters and values.

Parameter Value Required?

less

Currently, LESS is the only file type supported.

Yes

<file>

Space-separated list of CSS files to convert to LESS without the .css extension. (Default is css/styles-m)

No

--locale

Space-separated list of locale codes.

To display the list of locale codes, enter magento info:language:list

No

--area

Space-separated list of areas (adminhtml for the administrative area, frontend for the storefront).

No

--theme

Space-separated list of theme names in <VendorName>/<theme name> format. For example, Magento/blank.

No

For example, to create LESS files for the frontend theme named VendorName/themeName in the en_US locale using a CSS file named <your Magento install dir>/pub/static/frontend/VendorName/themeName/en_US/css/styles-l.css, enter the following command:

magento dev:source-theme:deploy less css/styles-l --locale="en_US" --area="frontend" --theme="VendorName/themeName"

The following messages display to confirm success:

Gathering css/styles-l.less sources.
Successfully processed LESS files