• Complain

Ben Frain [Ben Frain] - Enduring CSS

Here you can read online Ben Frain [Ben Frain] - Enduring CSS full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: Packt Publishing, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Ben Frain [Ben Frain] Enduring CSS

Enduring CSS: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Enduring CSS" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Key Features
  • Address the problems of CSS at scale, avoiding the shortfalls of scaling CSS.
  • The shortfalls of conventional approaches to scaling CSS.
  • Develop consistent and enforceable selector naming conventions with ECSS.
  • Learn how to organize project structure to more easily isolate and decouple visual components.
Book Description

Learn with me, Ben Frain, about how to really THINK about CSS and how to use CSS for any size project! Ill show you how to write CSS that endures continual iteration, multiple authors, and yet always produces predictable results. Enduring CSS, often referred to as ECSS, offers you a robust and proven approach to authoring and maintaining style sheets at scale.

Enduring CSS is not a book about writing CSS, as in the stuff inside the curly braces. This is a book showing you how to think about CSS, and be a smarter developer with that thinking! Its about the organisation and architecture of CSSthe parts outside the braces. I will help you think about the aspects of CSS development that become the most difficult part of writing CSS in larger projects.

Youll learn about the problems of authoring CSS at scaleincluding specificity, the cascade and styles intrinsically tied to document structure. Ill introduce you to the ECSS methodology, and show you how to develop consistent and enforceable selector naming conventions. Well cover how to apply ECSS to your web applications and visual model, and how you can organize your project structure wisely, and handle visual state changes with ARIA, providing greater accessibility considerations. In addition, well take a deep look into CSS tooling and process considerations. Finally we will address performance considerations by examining topics such as CSS selector speed with hard data and browser-representative insight.

What you will learn
  • The problems of CSS at scalespecificity, the cascade and styles intrinsically tied to element structure.
  • The shortfalls of conventional approaches to scaling CSS.
  • The ECSS methodology and the problems it solves.
  • How to develop consistent and enforceable selector naming conventions with ECSS.
  • How to organise project structure to more easily isolate and decouple visual components.
  • How to handle state changes in the DOM with ARIA or override selectors.
  • How to apply ECSS to web applications and visual modules.
  • Considerations of CSS tooling and processing: Sass/PostCSS and linting.
  • Addressing the notion of CSS selector speed with hard data and browser representative insight
About the Author

Ben Frain, Senior Front-end Developer at bet365, is a widely respected CSS developer and industry thought leader. Ben is the author of two successful and widely respected books Responsive Web Design with HTML5 and CSS3 and Sass and Compass for Designers, both published by Packt Publishing. Ben lives in Cheshire, England with his wife and two children. You can follow him on Twitter at http://twitter.com/benfrain and at his website (http://benfrain.com).

Table of Contents
  1. Writing Styles for Rapidly Changing, Long-lived Projects
  2. The Problems of CSS at Scale
  3. Implementing Received Wisdom
  4. Introducing the ECSS Methodology
  5. File Organisation and Naming Conventions
  6. Dealing with State Changes in ECSS
  7. Applying ECSS to your Website or Application
  8. The Ten Commandments of Sane Style Sheets
  9. Tooling for an ECSS Approach
  10. CSS Selector Performance
  11. Browser Representatives on CSS Performance

**

About the Author

Ben Frain, Senior Front-end Developer at bet365, is a widely respected CSS developer and industry thought leader. Ben is the author of two successful and widely respected books Responsive Web Design with HTML5 and CSS3 and Sass and Compass for Designers, both published by Packt Publishing. Ben lives in Cheshire, England with his wife and two children.

Ben Frain [Ben Frain]: author's other books


Who wrote Enduring CSS? Find out the surname, the name of the author of the book and a list of all author's works by series.

Enduring CSS — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Enduring CSS" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Appendix 1. CSS Selector Performance

Back at the beginning of 2014 I was having a debate (I used air-quotes there people) with some fellow developers about the irrelevance, or not, of worrying about CSS selector speed.

Whenever exchanging theories/evidence about the relative speed of CSS selectors, developers often reference Steve Souders (http://stevesouders.com/) work on CSS selectors from 2009. It's used to validate claims such as attribute selectors are slow or pseudo selectors are slow .

For the last few years, I've felt these kinds of things just weren't worth worrying about. The sound-bite I have been wheeling out for years is:

With CSS, architecture is outside the braces; performance is inside

But besides referencing Nicole Sullivan's later post on Performance Calendar (http://calendar.perfplanet.com/2011/css-selector-performance-has-changed-for-the-better/) to back up my conviction that the selectors used don't really matter, I had never actually tested the theory.

To try and address this, I attempted to produce some tests of my own that would settle the argument. At the least, I believed it would prompt someone with more knowledge/evidence to provide further data.

Testing selector speed

Steve Souders' aforementioned tests use JavaScripts new Date(). However, nowadays, modern browsers (iOS/Safari were a notable exception at the time of testing) support the Navigation Timing API (https://www.w3.org/TR/navigation-timing/) which gives us a more accurate measure we can use. For the tests, I implemented it like this:

;(function TimeThisMother() { window.onload = function(){ setTimeout(function(){ var t = performance.timing; alert("Speed of selection is: " + (t.loadEventEnd - t.responseEnd) + " milliseconds"); }, 0); }; })();

This lets us limit the timing of the tests between the point all assets have been received (responseEnd) and the point the page is rendered (loadEventEnd).

So, I set up a very simple test. 20 different pages, all with an identical, enormous DOM, made up of 1000 identical chunks of this markup:

20 different CSS selection methods were tested to colour the inner most nodes red. Each page differed only in the rule applied to select the inner most node within the blocks. Here were the different selectors tested and a link to the the test page for that selector:

  1. Data attribute: https://benfrain.com/selector-test/01.html
  2. Data attribute (qualified): https://benfrain.com/selector-test/02.html
  3. Data attribute (unqualified but with value): https://benfrain.com/selector-test/03.html
  4. Data attribute (qualified with value): https://benfrain.com/selector-test/04.html
  5. Multiple data attributes (qualified with values): https://benfrain.com/selector-test/05.html
  6. Solo pseudo selector (e.g. :after): https://benfrain.com/selector-test/06.html
  7. Combined classes (e.g. class1.class2): https://benfrain.com/selector-test/07.html
  8. Multiple classes: https://benfrain.com/selector-test/08.html
  9. Multiple classes with child selector: https://benfrain.com/selector-test/09.html
  10. Partial attribute matching (e.g. [class=wrap]): https://benfrain.com/selector-test/10.html
  11. nth-child selector: https://benfrain.com/selector-test/11.html
  12. nth-child selector followed by another nth-child selector: https://benfrain.com/selector-test/12.html
  13. Insanity selection (all selections qualified, every class used e.g. div.wrapper> div.tagDiv > div.tagDiv.layer2 > ul.tagUL > li.tagLi > b.tagB > a.TagA.link): https://benfrain.com/selector-test/13.html
  14. Slight insanity selection (e.g. .tagLi .tagB a.TagA.link): https://benfrain.com/selector-test/14.html
  15. Universal selector: https://benfrain.com/selector-test/15.html
  16. Element single: https://benfrain.com/selector-test/16.html
  17. Element double: https://benfrain.com/selector-test/17.html
  18. Element treble: https://benfrain.com/selector-test/18.html
  19. Element treble with pseudo: https://benfrain.com/selector-test/19.html
  20. Single class: https://benfrain.com/selector-test/20.html

The test was run 5 times on each browser and the result averaged across the 5 results. The browsers tested:

  • Chrome 34.0.1838.2 dev
  • Firefox 29.0a2 Aurora
  • Opera 19.0.1326.63
  • Internet Explorer 9.0.8112.16421
  • Android 4.2 (7" tablet)

A previous version of Internet Explorer (rather than the latest Internet Explorer available to me) was used to shed some light on how a non evergreen browser performed. All the other browsers tested received regular updates so I wanted to be sure that there wasn't a considerable difference in the way modern regularly updating browsers deal with CSS selectors and how slightly older ones do.

Note

Want to try the same tests out for yourself? Go and grab the files from this GitHub link: https://github.com/benfrain/css-performance-tests. Just open each page in your browser of choice (remember the browser must support the Network Timing API to alert a response). Also be aware that when I performed the test I discarded the first couple of results as they tended to be unusually high in some browsers.

Tip

When considering the results, don't consider one browser against another. That is not the purpose of the tests. The purpose is purely to try and evaluate the comparative difference in selection speed between the different selectors employed on each browser. For example, is selector 3 any faster than selector 7 on any browser? Therefore, when looking at the table, it makes more sense to look down the columns than across the rows.

Here are the results. All times in milliseconds:

Test

Chrome 34

Firefox 29

Opera 19

IE 19

Android 4

56.8

125.4

63.6

152.6

1455.2

55.4

128.4

61.4

1404.6

125.6

61.8

152.4

1363.4

54.8

63.2

147.4

1421.2

55.4

124.4

63.2

147.4

1411.2

60.6

58.4

1500.4

51.2

126.6

56.8

147.8

1453.8

48.8

127.4

56.2

150.2

1398.8

48.8

127.4

55.8

154.6

1348.4

52.2

129.4

1420.2

127.4

56.6

148.4

1352

50.6

127.2

58.4

146.2

1377.6

64.6

129.2

72.4

152.8

1461.2

50.2

129.8

54.8

154.6

1381.2

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Enduring CSS»

Look at similar books to Enduring CSS. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Enduring CSS»

Discussion, reviews of the book Enduring CSS and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.