Skip to content

Commit bcf4112

Browse files
authored
Improve the docs (#77)
Add more information about the bundle's behaviour after #76
1 parent 20b9358 commit bcf4112

File tree

1 file changed

+36
-16
lines changed

1 file changed

+36
-16
lines changed

doc/index.rst

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Sass For Symfony!
44
This bundle makes it easy to use Sass with Symfony's AssetMapper Component
55
(no Node required!).
66

7-
- Automatically downloads the correct Sass binary
7+
- Automatically detects the Sass binary installed in the system
8+
- Automatically downloads the correct Sass binary if it's not detected in the system
89
- Adds a ``sass:build`` command to build and watch your Sass changes
910

1011
.. tip::
@@ -25,7 +26,7 @@ Install the bundle:
2526
Usage
2627
-----
2728

28-
Start by writing your first Sass file ``assets/styles/app.scss``, and let's add some basic style
29+
Start by writing your first Sass file ``assets/styles/app.scss``, and let's add some basic style:
2930

3031
.. code-block:: scss
3132
@@ -37,7 +38,7 @@ Start by writing your first Sass file ``assets/styles/app.scss``, and let's add
3738
background: $red;
3839
}
3940
40-
Then point your styles in your template
41+
Then point your styles in your template:
4142

4243
.. code-block:: html+twig
4344

@@ -79,16 +80,21 @@ to be started whenever you run ``symfony server:start``:
7980
How Does it Work?
8081
-----------------
8182

82-
The first time you run one of the Sass commands, the bundle will download the correct Sass binary for your system into the ``bin/dart-sass`` directory.
83+
The first time you run one of the Sass commands, the bundle will automatically try to detect
84+
the correct Sass binary installed in the system and use it. If the binary is not found,
85+
the bundle will automatically download the correct one for your system and put it into
86+
the ``bin/dart-sass`` directory.
8387

84-
When you run ``sass:build``, that binary is used to compile Sass files into a ``var/sass/app.built.css`` file. Finally, when the contents of ``assets/styles/app.scss`` are requested, the bundle swaps the contents of that file with the contents of ``var/sass/app.built.css``. Nice!
88+
When you run ``sass:build``, that binary is used to compile Sass files into a ``var/sass/app.built.css``
89+
file. Finally, when the contents of ``assets/styles/app.scss`` are requested, the bundle swaps
90+
the contents of that file with the contents of ``var/sass/app.built.css``. Nice!
8591

8692
Excluding Sass Files from AssetMapper
8793
-------------------------------------
8894

8995
Because you have ``.scss`` files in your ``assets/`` directory, when you deploy, these
9096
source files will be copied into the ``public/assets/`` directory. To prevent that,
91-
you can exclude them from asset mapper:
97+
you can exclude them from AssetMapper:
9298

9399
.. code-block:: yaml
94100
# config/packages/asset_mapper.yaml
@@ -106,19 +112,20 @@ you can exclude them from asset mapper:
106112
this *is* used in AssetMapper and its contents are swapped for the final, built CSS.
107113

108114

109-
How to Get Source Sass Files for 3rd-party Libraries
115+
How to Get Source Sass Files for 3rd-Party Libraries
110116
----------------------------------------------------
111117

112-
The easiest way to get 3rd-party Sass files is via Composer. For example, see
113-
the section below to know how to get the source Sass files for Bootstrap.
118+
The easiest way to get 3rd-party Sass files is via `Composer <https://getcomposer.org/>`_. For example, see
119+
the section below to know how to get the source Sass files for `Bootstrap <https://getbootstrap.com/>`_.
114120

115121
But if you're using a library that isn't available via Composer, you’ll need
116122
to either download it to your app manually or grab it via NPM.
117123

118124
Using Bootstrap Sass
119125
~~~~~~~~~~~~~~~~~~~~
120126

121-
`Bootstrap <https://getbootstrap.com/>`_ is available as Sass, allowing you to customize the look and feel of your app. An easy way to get the source Sass files is via a Composer package:
127+
`Bootstrap <https://getbootstrap.com/>`_ is available as Sass, allowing you to customize
128+
the look and feel of your app. An easy way to get the source Sass files is via a Composer package:
122129

123130
.. code-block:: terminal
124131
@@ -169,7 +176,8 @@ When you deploy, run ``sass:build`` command before the ``asset-map:compile`` com
169176
Limitation: ``url()`` Relative Paths
170177
------------------------------------
171178

172-
When using ``url()`` inside a Sass file, currently, the path must be relative to the *root* ``.scss`` file. For example, suppose the root ``.scss`` file is:
179+
When using ``url()`` inside a Sass file, currently, the path must be relative to the *root* ``.scss`` file.
180+
For example, suppose the root ``.scss`` file is:
173181

174182
.. code-block:: scss
175183
@@ -189,7 +197,8 @@ Assume there is an ``assets/images/login-bg.png`` file that you want to refer to
189197
background-image: url('../images/login-bg.png');
190198
}
191199
192-
It should be possible to use ``url()`` with a path relative to the current file. However, that is not currently possible. See `this issue <https://github.com/SymfonyCasts/sass-bundle/issues/2>`_ for more details.
200+
It should be possible to use ``url()`` with a path relative to the current file. However, that is not
201+
currently possible. See `this issue <https://github.com/SymfonyCasts/sass-bundle/issues/2>`_ for more details.
193202

194203
Configuration
195204
-------------
@@ -204,13 +213,14 @@ To see the full config from this bundle, run:
204213
Source Sass file
205214
~~~~~~~~~~~~~~~~
206215

207-
The main option is ``root_sass`` option, which defaults to ``assets/styles/app.scss``. This represents the source Sass file.
216+
The main option is the ``root_sass`` option, which defaults to ``assets/styles/app.scss``.
217+
This represents the source Sass file:
208218

209219
.. code-block:: yaml
210220
211221
# config/packages/symfonycasts_sass.yaml
212222
symfonycasts_sass:
213-
root_sass: 'assets/styles/app.scss'
223+
root_sass: 'assets/styles/app.scss'
214224
215225
.. note::
216226

@@ -241,7 +251,7 @@ You can configure most of the `Dart Sass CLI options <https://sass-lang.com/docu
241251
# Register additional load paths. Defaults to empty array.
242252
# load_path: []
243253
244-
# Wether to generate source maps. Defaults to true when "kernel.debug" is true.
254+
# Whether to generate source maps. Defaults to true when "kernel.debug" is true.
245255
# source_map: true
246256
247257
# Embed source file contents in source maps. Defaults to false.
@@ -266,13 +276,23 @@ You can configure most of the `Dart Sass CLI options <https://sass-lang.com/docu
266276
Using a different binary
267277
------------------------
268278

269-
This bundle already installed for you the right binary. However, if you already have a binary installed on your machine you can instruct the bundle to use that binary, set the ``binary`` option:
279+
This bundle has already detected or installed for you the right binary. However, if you already have a binary
280+
installed on your machine and somehow the bundle has not been able to find it automatically - you can instruct
281+
the bundle to use that binary, set the ``binary`` option:
270282

271283
.. code-block:: yaml
272284
273285
symfonycasts_sass:
274286
binary: 'node_modules/.bin/sass'
275287
288+
.. tip::
289+
290+
If a path in the ``binary`` option is explicitly specified - the bundle will just use it
291+
which means it will not try to search a binary itself or download it automatically for your system.
292+
To let the bundle take care of it automatically - do not specify the ``binary`` option.
293+
294+
295+
276296
Register Additional Load Paths
277297
------------------------------
278298

0 commit comments

Comments
 (0)