Skip to content

Commit 123e51f

Browse files
committed
[REF] ir_qweb: less webasset: compress output instead of minifying it
* Remove dependency on less-plugin-clean-css which distribution packages are broken on debian stretch and derivated. * Updated documentation. * Lessc provides a `--compress` argument that could solve this issue. According to the documentation at http://lesscss.org/usage/: "[...] Compress using less built-in compression. This does an okay job but does not utilise all the tricks of dedicated css compression[...]" However, using this argument works on lessc 2.5.3 but not on 1.4.2 (`--compress` arg is present but seems to be break some rules i haven't been able to put my finger on). * Finally, use the minification of the StylesheetAsset that takes care of removing the spaces, the comments and the sourcemap with regexes. fixes issue odoo#9113
1 parent b466a9e commit 123e51f

File tree

7 files changed

+7
-15
lines changed

7 files changed

+7
-15
lines changed

debian/control

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Depends:
1515
${misc:Depends},
1616
adduser,
1717
node-less,
18-
node-clean-css,
1918
postgresql-client,
2019
python,
2120
python-dateutil,

doc/setup/install.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -462,25 +462,25 @@ Source installation requires manually installing dependencies:
462462
$ apt-get install -y npm
463463
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
464464
465-
Once npm is installed, use it to install less and less-plugin-clean-css:
465+
Once npm is installed, use it to install less:
466466

467467
.. code-block:: console
468468
469-
$ sudo npm install -g less less-plugin-clean-css
469+
$ sudo npm install -g less
470470
471471
- on OS X, install nodejs via your preferred package manager (homebrew_,
472-
macports_) then install less and less-plugin-clean-css:
472+
macports_) then install less:
473473

474474
.. code-block:: console
475475
476-
$ sudo npm install -g less less-plugin-clean-css
476+
$ sudo npm install -g less
477477
478478
- on Windows, `install nodejs <http://nodejs.org/download/>`_, reboot (to
479-
update the :envvar:`PATH`) and install less and less-plugin-clean-css:
479+
update the :envvar:`PATH`) and install less:
480480

481481
.. code-block:: ps1
482482
483-
C:\> npm install -g less less-plugin-clean-css
483+
C:\> npm install -g less
484484
485485
Running Odoo
486486
------------

openerp/addons/base/ir/ir_qweb.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1636,9 +1636,6 @@ def __init__(self, *args, **kw):
16361636
self.html_url_format = '%%s/%s/%%s.css' % self.bundle.xmlid
16371637
self.html_url_args = tuple(self.url.rsplit('/', 1))
16381638

1639-
def minify(self):
1640-
return self.with_header()
1641-
16421639
def get_source(self):
16431640
content = self.inline or self._fetch_content()
16441641
return "/*! %s */\n%s" % (self.id, content)
@@ -1688,7 +1685,7 @@ def get_command(self):
16881685
except IOError:
16891686
lessc = 'lessc'
16901687
lesspath = get_resource_path('web', 'static', 'lib', 'bootstrap', 'less')
1691-
return [lessc, '-', '--clean-css', '--no-js', '--no-color', '--include-path=%s' % lesspath]
1688+
return [lessc, '-', '--no-js', '--no-color', '--include-path=%s' % lesspath]
16921689

16931690
def rjsmin(script):
16941691
""" Minify js with a clever regex.

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ requires =
66
babel
77
libxslt-python
88
nodejs-less
9-
nodejs-clean-css
109
pychart
1110
pyparsing
1211
python-dateutil

setup/package.dfcentos

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ RUN yum install -d 0 -e 0 epel-release -y && \
1010
babel \
1111
libxslt-python \
1212
nodejs-less \
13-
nodejs-clean-css \
1413
pychart \
1514
pyparsing \
1615
python-dateutil \

setup/package.dfdebian

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ RUN apt-get update -qq && \
1818
apt-get install \
1919
adduser \
2020
node-less \
21-
node-clean-css \
2221
postgresql \
2322
postgresql-client \
2423
python \

setup/package.dfsrc

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ RUN apt-get update -qq && \
2121
postgresql-client \
2222
adduser \
2323
node-less \
24-
node-clean-css \
2524
libxml2-dev \
2625
libxslt1-dev \
2726
libldap2-dev \

0 commit comments

Comments
 (0)