11Using with Flask
22================
33
4- This guide explains how to use libsass with Flask _ web framework.
4+ This guide explains how to use libsass with the Flask _ web framework.
55:mod: `sassutils ` package provides several tools that can be integrated
6- to web applications written in Flask.
6+ into web applications written in Flask.
77
88.. _Flask : http://flask.pocoo.org/
99
@@ -35,31 +35,31 @@ Defining manifest
3535-----------------
3636
3737The :mod: `sassutils ` defines a concept named :dfn: `manifest `.
38- Manifest is building settings of Sass/SCSS. It specifies some paths
38+ Manifest is the build settings of Sass/SCSS. It specifies some paths
3939related to building Sass/SCSS:
4040
4141- The path of the directory which contains Sass/SCSS source files.
42- - The path of the directory compiled CSS files will go.
43- - The path, is exposed to HTTP (through WSGI), of the directory that
44- will contain compiled CSS files.
42+ - The path of the directory which the compiled CSS files will go.
43+ - The path, exposed to HTTP (through WSGI), of the directory that
44+ will contain the compiled CSS files.
4545
46- Every package may have their own manifest. Paths have to be relative
46+ Every package may have its own manifest. Paths have to be relative
4747to the path of the package.
4848
49- For example, in the project the package name is :mod: `myapp `.
50- The path of the package is :file: `myapp/ `. The path of Sass/SCSS directory
51- is :file: `static/sass/ ` (relative to the package directory).
52- The path of CSS directory is :file: `static/css/ `.
49+ For example, in the above project, the package name is :mod: `myapp `.
50+ The path of the package is :file: `myapp/ `. The path of the Sass/SCSS
51+ directory is :file: `static/sass/ ` (relative to the package directory).
52+ The path of the CSS directory is :file: `static/css/ `.
5353The exposed path is :file: `/static/css `.
5454
55- This settings can be represented as the following manifests::
55+ These settings can be represented as the following manifests::
5656
5757 {
5858 'myapp': ('static/sass', 'static/css', '/static/css')
5959 }
6060
61- As you can see the above, the set of manifests are represented in dictionary.
62- Keys are packages names. Values are tuples of paths.
61+ As you can see the above, the set of manifests are represented in dictionary,
62+ in which the keys are packages names and the values are tuples of paths.
6363
6464
6565Building Sass/SCSS for each request
@@ -72,21 +72,21 @@ Building Sass/SCSS for each request
7272 Flask.
7373
7474 Flask --- :ref: `flask:app-dispatch `
75- The documentation which explains how Flask dispatch each
75+ The documentation which explains how Flask dispatches each
7676 request internally.
7777
7878 __ http://flask.pocoo.org/docs/quickstart/#hooking-in-wsgi-middlewares
7979
80- In development, to manually build Sass/SCSS files for each change is
81- so tiring . :class: `~sassutils.wsgi.SassMiddleware ` makes the web
82- application to automatically build Sass/SCSS files for each request.
80+ In development, manually building Sass/SCSS files for each change is
81+ a tedious task . :class: `~sassutils.wsgi.SassMiddleware ` makes the web
82+ application build Sass/SCSS files for each request automatically .
8383It's a WSGI middleware, so it can be plugged into the web app written in
8484Flask.
8585
8686:class: `~sassutils.wsgi.SassMiddleware ` takes two required parameters:
8787
8888- The WSGI-compliant callable object.
89- - The set of manifests represented as dictionary.
89+ - The set of manifests represented as a dictionary.
9090
9191So::
9292
9999 'myapp': ('static/sass', 'static/css', '/static/css')
100100 })
101101
102- And then, if you want to link a compiled CSS file, use :func: ` ~flask.url_for() `
103- function:
102+ And then, if you want to link a compiled CSS file, use the
103+ :func: ` ~flask.url_for() ` function:
104104
105105.. sourcecode :: html+jinja
106106
@@ -125,10 +125,10 @@ Building Sass/SCSS for each deployment
125125 Flask --- :ref: `flask:distribute-deployment `
126126 How to deploy Flask application using setuptools _.
127127
128- If libsass has been installed in the :file: `site-packages ` (for example,
129- your virtualenv), :file: `setup.py ` script also gets had new command
128+ If libsass is installed in the :file: `site-packages ` (for example,
129+ your virtualenv), the :file: `setup.py ` script also gets a new command
130130provided by libsass: :class: `~sassutils.distutils.build_sass `.
131- The command is aware of ``sass_manifests `` option of :file: `setup.py ` and
131+ The command is aware of the ``sass_manifests `` option of :file: `setup.py ` and
132132builds all Sass/SCSS sources according to the manifests.
133133
134134Add these arguments to :file: `setup.py ` script::
@@ -141,35 +141,35 @@ Add these arguments to :file:`setup.py` script::
141141 }
142142 )
143143
144- The ``setup_requires `` option makes sure that the libsass is installed
144+ The ``setup_requires `` option makes sure that libsass is installed
145145in :file: `site-packages ` (for example, your virtualenv) before
146- :file: `setup.py ` script. That means: if you run :file: `setup.py ` script
147- and libsass isn't installed yet at the moment , it will automatically
146+ the :file: `setup.py ` script. That means if you run the :file: `setup.py `
147+ script and libsass isn't installed in advance , it will automatically
148148install libsass first.
149149
150150The ``sass_manifests `` specifies the manifests for libsass.
151151
152152Now :program: `setup.py build_sass ` will compile all Sass/SCSS files
153- in the specified path and generates compiled CSS files into the specified
153+ in the specified path and generates compiled CSS files inside the specified
154154path (according to the manifests).
155155
156- If you use it with ``sdist `` or ``bdist `` command, a packed archive also
157- will contain compiled CSS files!
156+ If you use it with ``sdist `` or ``bdist `` commands, the packed archive will
157+ also contain the compiled CSS files!
158158
159159.. sourcecode :: console
160160
161161 $ python setup.py build_sass sdist
162162
163- You can add aliases to make these commands to always run ``build_sass ``
164- command before . Make :file: `setup.cfg ` config:
163+ You can add aliases to make these commands always run the ``build_sass ``
164+ command first . Make :file: `setup.cfg ` config:
165165
166166.. sourcecode :: ini
167167
168168 [aliases]
169169 sdist = build_sass sdist
170170 bdist = build_sass bdist
171171
172- Now it automatically builds Sass/SCSS sources and include compiled CSS files
172+ Now it automatically builds Sass/SCSS sources and include the compiled CSS files
173173to the package archive when you run :program: `setup.py sdist `.
174174
175175.. _setuptools : https://pypi.org/pypi/setuptools/
0 commit comments