You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: guides/v2.0/frontend-dev-guide/css-topics/css-preprocess.md
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,17 @@ For each CSS file included in the layouts, LESS preprocessor does the following:
97
97
98
98
</ol>
99
99
100
+
#### Styles debugging in server-side compilation mode {#css_debug_server}
101
+
102
+
In server-side LESS compilation mode, to have your changes applied, clear <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> by deleting the directory in the file system, and reload the store pages to trigger compilation and publication.
103
+
104
+
<divclass="bs-callout bs-callout-info"id="info">
105
+
<p>You might also need to clear the <code>var/cache</code> and <code>var/view_preprocessing</code> directories.</p>
106
+
</div>
107
+
108
+
Alternatively, to streamline the process of applying and debugging styles customizations, in server-side compilation mode, you can use the <ahref="http://gruntjs.com/"target="_blank">Grunt JavaScript task runner</a>.
109
+
110
+
See the [Using Grunt for compiliing .less files]({{page.baseurl}}frontend-dev-guide/css-topics/css_debug.md) topic for details how to install, configure and use Grunt.
100
111
101
112
<h3id="client-side">Client-side LESS compilation</h3>
102
113
The client-side compilation flow is similar to server-side. The difference is in the set of files, published to <code>pub/static</code> on the <ahref="#compile_last">last step</a>. In the client-side mode, the following files are published to the <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> directory:
@@ -107,6 +118,25 @@ The client-side compilation flow is similar to server-side. The difference is in
107
118
<li>symlinks to the <code>.less</code> files included to the root source files using the imported by <code>@magento_import</code> and <code>@import</code> directives</li>
108
119
</ul>
109
120
121
+
#### Styles debugging in client-side compilation mode {#css_debug_client}
122
+
123
+
Client-side LESS compilation is implemented using the native `less.js` library. The default configuration is set in <code>lib/web/less/config.less.js</code>; you can change it as needed.
124
+
125
+
You can find the detailed information about the configuration and other options of the <code>less.js</code> used in a browser at <ahref="http://lesscss.org/usage/#using-less-in-the-browser"target="_blank">http://lesscss.org/usage/#using-less-in-the-browser</a>.
126
+
127
+
In client-side compilation mode, most of the stylesheet customizations display immediately after you reload a page in a browser.
128
+
129
+
<spanid="css_exception">There are certain types of changes</span>, that require you to clear the <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> directory and trigger the compilation and <ahref="{{page.baseurl}}architecture/view/static-process.html#publish-static-view-files"target="_blank">publication</a> processes anew.
130
+
131
+
This is required in the following cases:
132
+
<ul>
133
+
<li>If you change the <ahref="{{page.baseurl}}frontend-dev-guide/css-topics/css-preprocess.html#css_preprocess_terms"target="_blank">root source files</a> that contain the <code>@magento_import</code> directive, or the <code>@import</code> directive where the imported file is specified without extension.</li>
134
+
<li>If you rename, remove, or add a <code>.less</code> file imported with a <code>@magento_import</code> or <code>@import</code> directive but you did not correct the directives accordingly.</li>
135
+
136
+
</ul>
137
+
138
+
To clear the <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> directory, delete the directory in the file system, and reload the store pages in a browser to trigger compilation and publication.
<p><code>@magento_import</code> is a Magento-specific LESS directive that allows including multiple files by a name pattern. It is used to include files with the same name from the different locations, for example, different modules.
The topic describes how the changes you make in stylesheets are applied in the client-side and server-side LESS <ahref="{{page.baseurl}}frontend-dev-guide/css-topics/css-preprocess.html"target="_blank">compilation modes</a>, and suggests the approaches and tools you can use to streamline the process of applying and debugging customizations. </p>
16
+
The topic describes how to install, configure and use <ahref="http://gruntjs.com/"target="_blank">Grunt JavaScript task runner</a> for compiling <code>.less</code> files in Magento 2. </p>
17
17
18
18
**Contents**
19
19
@@ -23,36 +23,6 @@ The topic describes how the changes you make in stylesheets are applied in the c
23
23
## Prerequisites
24
24
Make sure that you [set]({{page.baseurl}}config-guide/cli/config-cli-subcommands-mode.html) your Magento application to the developer or default [mode]({{page.baseurl}}config-guide/bootstrap/magento-modes.html).
25
25
26
-
## Styles debugging in client-side compilation mode {#css_debug_client}
27
-
28
-
Client-side LESS compilation is implemented using the native `less.js` library. The default configuration is set in <code>lib/web/less/config.less.js</code>; you can change it as needed.
29
-
30
-
You can find the detailed information about the configuration and other options of the <code>less.js</code> used in a browser at <ahref="http://lesscss.org/usage/#using-less-in-the-browser"target="_blank">http://lesscss.org/usage/#using-less-in-the-browser</a>.
31
-
32
-
In client-side compilation mode, most of the stylesheet customizations display immediately after you reload a page in a browser.
33
-
34
-
<spanid="css_exception">There are certain types of changes</span>, that require you to clear the <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> directory and trigger the compilation and <ahref="{{page.baseurl}}architecture/view/static-process.html#publish-static-view-files"target="_blank">publication</a> processes anew.
35
-
36
-
This is required in the following cases:
37
-
<ul>
38
-
<li>If you change the <ahref="{{page.baseurl}}frontend-dev-guide/css-topics/css-preprocess.html#css_preprocess_terms"target="_blank">root source files</a> that contain the <code>@magento_import</code> directive, or the <code>@import</code> directive where the imported file is specified without extension.</li>
39
-
<li>If you rename, remove, or add a <code>.less</code> file imported with a <code>@magento_import</code> or <code>@import</code> directive but you did not correct the directives accordingly.</li>
40
-
41
-
</ul>
42
-
43
-
To clear the <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> directory, delete the directory in the file system, and reload the store pages in a browser to trigger compilation and publication.
44
-
45
-
## Styles debugging in server-side compilation mode {#css_debug_server}
46
-
47
-
In server-side LESS compilation mode, to have your changes applied, clear <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> by deleting the directory in the file system, and reload the store pages to trigger compilation and publication.
48
-
49
-
<divclass="bs-callout bs-callout-info"id="info">
50
-
<p>You might also need to clear the <code>var/cache</code> and <code>var/view_preprocessing</code> directories.</p>
51
-
</div>
52
-
53
-
Alternatively, to streamline the process of applying and debugging styles customizations, in server-side compilation mode, you can use the <ahref="http://gruntjs.com/"target="_blank">Grunt JavaScript task runner</a>.
54
-
55
-
The following section describes in details how to install, configure and use Grunt for styles debugging.
56
26
57
27
### Installing and configuring Grunt {#grunt_prereq}
The topic describes how the changes you make in stylesheets are applied in the client-side and server-side LESS <ahref="{{page.baseurl}}frontend-dev-guide/css-topics/css-preprocess.html"target="_blank">compilation modes</a>, and suggests the approaches and tools you can use to streamline the process of applying and debugging customizations. </p>
15
+
The topic describes how to install, configure and use <ahref="http://gruntjs.com/"target="_blank">Grunt JavaScript task runner</a> for compiling <code>.less</code> files in Magento 2. </p>
16
+
17
17
18
18
**Contents**
19
19
@@ -23,37 +23,6 @@ The topic describes how the changes you make in stylesheets are applied in the c
23
23
## Prerequisites
24
24
Make sure that you [set]({{page.baseurl}}config-guide/cli/config-cli-subcommands-mode.html) your Magento application to the developer or default [mode]({{page.baseurl}}config-guide/bootstrap/magento-modes.html).
25
25
26
-
## Styles debugging in client-side compilation mode {#css_debug_client}
27
-
28
-
Client-side LESS compilation is implemented using the native `less.js` library. The default configuration is set in <code>lib/web/less/config.less.js</code>; you can change it as needed.
29
-
30
-
You can find the detailed information about the configuration and other options of the <code>less.js</code> used in a browser at <ahref="http://lesscss.org/usage/#using-less-in-the-browser"target="_blank">http://lesscss.org/usage/#using-less-in-the-browser</a>.
31
-
32
-
In client-side compilation mode, most of the stylesheet customizations display immediately after you reload a page in a browser.
33
-
34
-
<spanid="css_exception">There are certain types of changes</span>, that require you to clear the <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> directory and trigger the compilation and <ahref="{{page.baseurl}}architecture/view/static-process.html#publish-static-view-files"target="_blank">publication</a> processes anew.
35
-
36
-
This is required in the following cases:
37
-
<ul>
38
-
<li>If you change the <ahref="{{page.baseurl}}frontend-dev-guide/css-topics/css-preprocess.html#css_preprocess_terms"target="_blank">root source files</a> that contain the <code>@magento_import</code> directive, or the <code>@import</code> directive where the imported file is specified without extension.</li>
39
-
<li>If you rename, remove, or add a <code>.less</code> file imported with a <code>@magento_import</code> or <code>@import</code> directive but you did not correct the directives accordingly.</li>
40
-
41
-
</ul>
42
-
43
-
To clear the <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> directory, delete the directory in the file system, and reload the store pages in a browser to trigger compilation and publication.
44
-
45
-
## Styles debugging in server-side compilation mode {#css_debug_server}
46
-
47
-
In server-side LESS compilation mode, to have your changes applied, clear <code>pub/static/frontend/<Vendor>/<theme>/<locale></code> by deleting the directory in the file system, and reload the store pages to trigger compilation and publication.
48
-
49
-
<divclass="bs-callout bs-callout-info"id="info">
50
-
<p>You might also need to clear the <code>var/cache</code> and <code>var/view_preprocessing</code> directories.</p>
51
-
</div>
52
-
53
-
Alternatively, to streamline the process of applying and debugging styles customizations, in server-side compilation mode, you can use the <ahref="http://gruntjs.com/"target="_blank">Grunt JavaScript task runner</a>.
54
-
55
-
The following section describes in details how to install, configure and use Grunt for styles debugging.
56
-
57
26
### Installing and configuring Grunt {#grunt_prereq}
58
27
59
28
Magento has built-in Grunt tasks configured, but there are still several prerequisite steps you need to take to be able to use it:
0 commit comments