Commit graph

13 commits

Author SHA1 Message Date
GitLab Bot
694555850c Add latest changes from gitlab-org/gitlab@master 2020-08-20 18:10:16 +00:00
GitLab Bot
018431c70e Add latest changes from gitlab-org/gitlab@master 2020-06-11 15:08:36 +00:00
GitLab Bot
f6e2f30241 Add latest changes from gitlab-org/gitlab@master 2020-03-31 00:08:09 +00:00
GitLab Bot
6f7881ee9d Add latest changes from gitlab-org/gitlab@master 2020-03-24 09:09:25 +00:00
GitLab Bot
d80f3cd75e Add latest changes from gitlab-org/gitlab@master 2020-03-04 09:08:20 +00:00
Tim Zallmann
5b05d2b987 First iteration of GitLab own Stylelints
DRYed the code

Changed new rules to warnings

Manual prettified and added stylelint rules
2019-03-26 08:13:21 +00:00
Annabel Dunstone Gray
0459c78fe5
Remove jquery.scss; Combine multiple duplicate grays into global gray variables; Remove unused styles in common.scss 2018-09-11 08:06:42 -05:00
Annabel Dunstone Gray
c298cd9c40 Update file hader styles; remove and relocate more commits css 2016-12-29 12:44:15 -06:00
Sam Rose
d6d22a5dbd Enable ColorVariable in scss-lint 2016-12-01 20:22:51 -05:00
Clement Ho
e88aa25f42 Enforce TrailingSemicolon and EmptyLineBetweenBlocks in scss-lint 2016-10-14 16:28:10 -05:00
Sean McGivern
f4cedacc7b Optimise email CSS for speed with Premailer
Remove all descendant selectors from the push email styling, to
drastically reduce CPU time when inlining the CSS for syntax-highlighted
diffs.

Background:

Premailer is a Ruby gem that inlines CSS styles from an external
stylesheet before emails are sent, so that they are compatible with
Gmail. At a high level, it parses the CSS files it finds, and parses the
email body with Nokogiri. It then loops through the selectors in the
CSS, using Nokogiri to find matching elements, and adds inline
styles. (It does more than this, like merging styles applied to the same
element, but that's not relevant to this issue.)

Nokogiri converts CSS selectors to XPath first, like so:
    Nokogiri::CSS.xpath_for('foo bar')
    # => ["//foo//bar"]

On documents with high node counts (say, a syntax-highlighted copy of
jQuery), having both descendant selectors is very expensive. Both
`//foo/bar` and `//bar` will be much more efficient, although neither
are directly equivalent.

An example, on a document containing two syntax-highlighted copies of
jQuery:
    Benchmark.realtime { p doc.search('.o').count }
    # 9476
    # => 0.3462457580026239
    Benchmark.realtime { p doc.search('.code.white .o').count }
    # 9476
    # => 85.51952634402551

The performance is similar for selectors which _don't_ match any
elements, and as Premailer loops through all the available selectors, we
want to avoid all descendant selectors in push emails.

Because of the theming support in the web UI, all syntax highlighting
selectors are descendant selectors of classes like `.code.white` or
`.code.monokai`. There are over 60 CSS classes for syntax highlighting
styles alone, all of which are expressed in the inefficient form above.

In emails we always use the white theme, and were reusing the same CSS
file. But in emails, we don't need to descend from `.code.white` as that
will always be the theme, and we can also remove some other selectors
that are only applicable to the web UI. For the remaining descendant
selectors, we can convert them to child selectors, type selectors, or
class selectors as appropriate.

As in the example above, having no descendant selectors at all in the
push email CSS can provide a drastic (and surprising) performance
improvement.
2016-06-07 12:33:19 +01:00
connorshea
edac38c439 Fixes last remaining lints and enables scss-lint test for GitLab CI.
With this, builds will now fail if they break the SCSS style guide (at
least, the parts enabled by the linter).

Discussed in #14299.
2016-03-22 15:01:31 -06:00
Douwe Maan
a8aa59e96e Inline mailer CSS using premailer.
# Conflicts:
#	Gemfile.lock
2016-03-19 20:04:10 +01:00