Reasoning with Style

Total Page:16

File Type:pdf, Size:1020Kb

Reasoning with Style Proceedings of the Twenty-Fourth International Joint Conference on Artificial Intelligence (IJCAI 2015) Reasoning with Style Mart´ı Bosch∗ y z Pierre Geneves` y z Nabil Laya¨ıday z ∗ Universitat Politecnica` de Catalunya y CNRS, LIG z Inria Abstract Mesbah and Mirshokraie, 2012]. The simplicity of CSS syn- tax may be misleading as it hides the complexity of its most The Cascading Style Sheets (CSS) language constitutes a key advanced aspects. For this reason, developers increasingly component of web applications. It offers a series of sophis- rely on frameworks that automatically generate CSS files. ticated features to stylize web pages. Its apparent simplicity This often results in a code that is very hard to maintain. This and power are however counter-balanced by the difficulty of also leads to redundant declarations and inaccessible selec- debugging and maintaining style sheets, tasks for which de- tors, that unnecessarily increase resources required to transfer velopers still lack appropriate tools. In particular, significant the CSS files (and therefore web traffic at a global scale) and portions of CSS code become either useless or redundant, and to process the page layout. Previous studies [Meyerovich and tend to accumulate over time. The situation becomes even Bodik, 2010] showed that the visual layout of web pages con- worse as more complex features are added to the CSS lan- sumes 40–70% of the processing time of the browser. Simpli- guage (e.g. CSS3 powerful selectors). A direct consequence fying CSS code is essential in reducing this cost. Current syn- is a waste of CPU that is required to display web pages, as tax optimizers1 perform only syntactic analyses, and are un- well as the significant amount of useless traffic at web scale. aware of the CSS semantics. Therefore, they can only achieve Style sheets are designed to operate on a set of documents a fraction of the potential optimizations. (possibly generated). However, existing techniques consist The standard CSS development practice involves the use of in syntax validators, optimizers and runtime debuggers that empirical methods such as runtime debuggers. While these operate in one particular document instance. As such, they tools are useful in testing, they depend strongly on the doc- do not provide guarantees concerning all web pages in CSS ument instance on which the style sheet is applied. How- refactoring, such as preservation of the formatting. This is ever, as style sheets usually apply to a wider set of docu- partly because they are essentially syntactic and do not take ments, modifications achieved on a particular instance might advantage of CSS semantics to detect redundancies. undesirably alter the presentation of other documents. On We propose a set of automated refactoring techniques aimed the other hand, CSS code very often comes from different at removing redundant and inaccessible declarations and sources, such as external files, the HTML’s style element, rules, without affecting the layout of any document to which or inline styles set directly as attributes on specific elements. the style sheet is applied. We implemented a prototype that This makes it hard to spot the origin of bugs, and incurs sig- has been extensively tested with popular web sites (such as nificant debugging costs. The tool we propose is intended to Google Sites, CNN, Apple, etc.). We show that significant remove redundant code, clean and refactor CSS files, lessen- size reduction can be obtained while preserving the code ing the reliance on debuggers as well as reducing file’s sizes. readability and improving maintainability. Our tool involves automated analysis of the style sheet se- mantics for performing size reductions which are not achiev- able by existing (syntactic) compressors. 1 Introduction Cascading Style Sheets (CSS) [Consortium, 2014; Lie, Contributions and Outline We recall the main concepts 2005] is a style sheet language used to format documents of CSS in Section 2. We propose automated refactoring tech- written in markup languages, and nowadays it is widely used niques in Section 3 that aim at removing redundant and in- to style web pages. To suit the current context, where so much accessible CSS declarations and rules, while preserving the attention is paid to the user experience in different kinds of layout of documents to which the style sheet is applied2. We devices, it includes a series of sophisticated features that offer implemented a prototype described in Section 4. We report a very wide range of possibilities to designers and developers. on experimental results with CSS of popular web sites (such Despite its widespread use and increasingly important as Google Sites, CNN, Apple, etc.) in Section 5. We show role, CSS received very little attention from the research community [Quint and Vatton, 2007; Marden and Munson, 1For example: cleancss.com, codebeautifier.com, csslint.net, etc. 1999] with the notable exceptions of [Geneves` et al., 2012; 2Work partially supported by ANR TYPEX ANR-11-BS02-00. 2227 that we obtain significant size reductions for these sites that techniques do not require any information other than the style represent a considerable fraction of web traffic. sheet itself, regardless of which instance is under considera- tion. For this purpose, our methods rely on the semantics 2 The CSS Language of the CSS components described previously. In particular, Cascading Style Sheets play nowadays a key role in the our method aim at analysing and leveraging the fact that in web infrastructure and in enhancing the user experience. Be- CSS, rules use selectors that match the set of elements that are sides web developers, the simplicity of its syntax has attracted styled by the rule’s declarations. Our main method consists also graphical and web designers. CSS permits separating the in the detection of semantic relations between CSS selectors. content from presentation and a few rules are capable of pro- When some of these relations are detected, further analysis of ducing impressively fancy presentations. A style sheet C can some CSS aspects might reveal that some declarations are in be seen as a sequence of rules, where each rule R consists of a fact unnecessary and can be deleted. selector S, and a set of declarations called declaration blocks. Selectors identify the set of elements that are styled by the 3.1 Deleting redundant declarations declarations di. Each declaration di is a pair of a property In the context of this paper, we will state a CSS declaration pi and its associated value vi, that define how the elements as redundant if (1) it is always masked by another declaration, selected by S will look like in the browser. or (2) it is verbose as the styling that it provides is already provided by some other declaration. 2.1 Selectors CSS selectors decide which elements will be styled by the Masked declarations rules’ declarations. The selectors’ language is very expressive A declaration da is always inactive iff it is masked by some and permits matching elements based on the elements’ struc- other declaration db concerning the same CSS property. In ture and attributes, as well as grouping selectors that share the order to mask da, db must apply to at least the same set of same declarations. Selectors Level 3 [C¸elik et al., 2011] also elements as da, and this is why relations between the selectors includes a series of advanced features that empower CSS’ under which da and db are stated become crucial: selectors styling capabilities while inevitably making it more complex. must either hold an equivalence or a containment relation. An efficient use of selectors is one of the key aspects towards the conception of maintainable CSS code. Listing 1: Example of masked declaration 2.2 Specificity 1 li.foo{ text-indent: none; 2 color: blue; When several rules apply to a given element, CSS priori- 3 font-weight: bold} tizes the declarations that have the !important specifier. 4 li[class=’foo’]{ text-indent: 10px; In case of equality, CSS picks the declaration whose selec- 5 color: blue} tor has a highest specificity. The specificity of a selector is represented by a four integer vector, whose components are, ¦ ¥ from most to less important, determined as: (1) 1 if the prop- In Listing 1 we have two rules with equivalent selectors: li.foo li[class=’foo’] li erty is declared under the style attribute, 0 otherwise, (2) “ ” and “ ” both select an class foo the number of references to the id attribute with the # sym- element with the attribute set to “ ”. They just bol, (3) the number of class selectors, attribute selectors and use different syntax to achieve the same semantics. Any el- pseudo-classes, and (4) the number of element type selectors ement matched by the first rule will also be matched by the and pseudo-elements. If the selectors have the same speci- second one and viceversa, and as both rules have declarations color text-indent ficity, the latter rule in the syntactic order gets precedence. concerning the properties and , CSS specificity will decide which values will apply. In Listing 1, 2.3 Media Rules both selectors have the same specificity, so the declarations A media rule starts by @media followed by a condition under the latter one “li[class=’foo’]” will have pref- called media query. This defines a block in which we can erence. Consequently, for these conflicting declarations, the add a set of CSS rules that only apply when the media query values from “li[class=’foo’]” will apply, and the ones is satisfied. The media queries define the style sheet target from “li.foo” will be always inactive (masked). By delet- according to expressions concerning devices’ features, as for ing those declarations we achieve a lighter code with the same example the dimensions.
Recommended publications
  • Style Sheets CSS
    P1: OSO/OVY P2: OSO/OVY QC: OSO/OVY T1: OSO GTBL013-03 GTBL013-Jackson-v10 July 12, 2006 10:36 CHAPTER 3 Style Sheets CSS As we have learned, HTML markup can be used to indicate both the semantics of a document (e.g., which parts are elements of lists) and its presentation (e.g., which words should be italicized). However, as noted in the previous chapter, it is advisable to use markup predominantly for indicating the semantics of a document and to use a separate mechanism to determine exactly how information contained in the document should be presented. Style sheets provide such a mechanism. This chapter presents basic information about Cascading Style Sheets (CSS), a style sheet technology designed to work with HTML and XML documents. CSS provides a great deal of control over the presentation of a document, but to exercise this control intelligently requires an understanding of a number of features. And, while you as a software developer may not be particularly interested in getting your web page to look “just so,” many web software developers are members of teams that include professional web page designers, some of whom may have precise presentation require- ments. Thus, while I have tried to focus on what I consider key features of CSS, I’ve also included a number of finer points that I believe may be more useful to you in the future than you might expect on first reading. While CSS is used extensively to style HTML documents, it is not the only style- related web technology.
    [Show full text]
  • Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification
    Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification W3C Recommendation 07 June 2011, edited in place 12 April 2016 to point to new work This version: http://www.w3.org/TR/2011/REC-CSS2-20110607 Latest version: http://www.w3.org/TR/CSS2 Previous versions: http://www.w3.org/TR/2011/PR-CSS2-20110412 http://www.w3.org/TR/2008/REC-CSS2-20080411/ Latest editor's draft: http://dev.w3.org/csswg/css2/ Editors: Bert Bos <BERT @w3.org> Tantek Çelik <TANTEK @cs.stanford.edu> Ian Hickson <IAN @hixie.ch> Håkon Wium Lie <HOWCOME @opera.com> Please refer to the errata for this document. This document is also available in these non-normative formats: plain text, gzip'ed tar file, zip file, gzip'ed PostScript, PDF. See also translations. Copyright © 2011 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C LIABILITY, TRADEMARK AND DOCUMENT USE rules apply. Abstract This specification defines Cascading Style Sheets, level 2 revision 1 (CSS 2.1). CSS 2.1 is a style sheet language that allows authors and users to attach style (e.g., fonts and spac- ing) to structured documents (e.g., HTML documents and XML applications). By separating the presentation style of documents from the content of documents, CSS 2.1 simplifies Web authoring and site maintenance. CSS 2.1 builds on CSS2 [CSS2] p. 284 which builds on CSS1 [CSS1] p. 283. It supports media-specific style sheets so that authors may tailor the presentation of their documents to visual browsers, aural devices, printers, braille devices, handheld devices, etc. It also sup- ports content positioning, table layout, features for internationalization and some properties related to user interface.
    [Show full text]
  • 1Lesson 1: Markup Language and Site Development Essentials
    1Lesson 1: Markup Language and Site Development Essentials Objectives By the end of this lesson, you will be able to: 2.1.1: Relate the history of markup languages to current techniques and technologies, including Standard Generalized Markup Language (SGML), previous versions of Hypertext Markup Language (HTML). 2.1.2: Identify the format and various versions of HTML, including HTML 4.01, Extensible HTML (XHTML), HTML5. 2.1.8: Explain the importance of consistently developing to a single W3C standard (e.g., HTML5). 2.6.1: Describe the functionality of XML. 2.7.1: Obtain input from stakeholders about acceptable technologies and color combinations. 2.7.2: Create an initial Web site diagram (i.e., a story board or prototype), and translate it into a site map. 2.7.3: Verify compliance with government and industry accessibility standards, including W3C Web Accessibility Initiative (WAI), U.S. Government Section 508, Americans with Disabilities Act (ADA). 2.7.4: Validate Web page design according to technical and audience standards adopted by employers. 2.7.5: Verify Web site usability, viewability and browser compatibility. 2.12.1: Test and validate Web documents. 2.12.3: Test Web pages in multiple browsers. 2.13.1: Work as a team member to develop pages and sites. 1-2 Site Development Associate 2.13.2: Collaborate with technical (e.g., IT) and non-technical (e.g., marketing) members of the organization to ensure sites meet requirements. 2.13.3: Determine information and audience requirements for a site, including stakeholders such as customers, employees, shareholders, suppliers. 2.13.4: Document a Web site plan.
    [Show full text]
  • Cascading Style Sheets for PGDCA HTML Styles – CSS Cascading Style Sheets (CSS) Is a Style Sheet Language Used for Describing
    Cascading Style Sheets for PGDCA Semester –II PGDCA-204 By: Arshdeep Singh, University computer centre HTML Styles – CSS Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language like HTML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript. CSS describes how HTML elements are to be displayed on screen, paper, or in other media. CSS can be added to HTML elements in 3 ways: Inline - by using the style attribute in HTML elements Internal - by using a <style> element in the <head> section External - by using an external CSS file Inline CSS An inline CSS is used to apply a unique style to a single HTML element and uses the style attribute of an HTML element. Example: <!DOCTYPE html> <html> <body> <h1 style="color:blue;">This is a red Heading</h1> </body> </html> Result in browser: This is a Blue Heading Internal CSS The internal style sheet is used to add a unique style for a single document. It is defined in <head> section of the HTML page inside the <style> tag. ... With Internal style sheets, you can style the visited, hover, active, and link color of an anchor tag. But in the Internal CSS, we can not control styles for multiple documents at once. Internal style Sheet is applicable to the Page in which it is included. Internal Style Sheet is used to style individual page. It’s impossible to style "pseudo-elements" and classes with inline styles. With Internal style sheets, you can style the visited, hover, active, and link color of an anchor tag.
    [Show full text]
  • Automated Extraction of Mixins in Cascading Style Sheets Alan Charpentier, Jean-Rémy Falleri, Laurent Réveillère
    Automated Extraction of Mixins in Cascading Style Sheets Alan Charpentier, Jean-Rémy Falleri, Laurent Réveillère To cite this version: Alan Charpentier, Jean-Rémy Falleri, Laurent Réveillère. Automated Extraction of Mixins in Cas- cading Style Sheets. 32rd IEEE International Conference on Software Maintenance and Evolution (ICSME), Oct 2016, Raleigh, United States. pp.56-66, 10.1109/ICSME.2016.15. hal-02182065 HAL Id: hal-02182065 https://hal.archives-ouvertes.fr/hal-02182065 Submitted on 6 Jan 2020 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Automated Extraction of Mixins in Cascading Style Sheets Alan Charpentier, Jean-Rémy Falleri and Laurent Réveillère University of Bordeaux LaBRI, UMR 5800 F-33400, Talence, France Email: {acharpen,falleri,reveillere}@labri.fr Abstract—Cascading style sheets (CSS) is a language that projects such as Bootstrap3 and Foundation4, the two most describes the presentation of web documents. CSS is widely popular CSS frameworks. However, many applications still adopted in web development and it is now common for web rely on low level CSS code. A recent survey5 with more than projects to have several thousands of CSS lines of code. Because the language lacks advanced features to allow code reuse, several 13; 000 responses from web developers showed that almost languages such as Sass and Less have emerged as extensions to half of them do not use CSS preprocessors.
    [Show full text]
  • Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification W3C First Public Working Draft 12 April 2016
    Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification W3C First Public Working Draft 12 April 2016 This version: http://www.w3.org/TR/2016/WD-CSS22-20160412/ Latest version: http://www.w3.org/TR/CSS22/ Latest CSS level 2: http://www.w3.org/TR/CSS2/ Latest CSS: http://www.w3.org/TR/CSS/ Editors' draft: http://dev.w3.org/csswg/css2/ Editors: Bert Bos <BERT @w3.org> Former editors: Tantek Çelik <TANTEK @cs.stanford.edu> Ian Hickson <IAN @hixie.ch> Håkon Wium Lie <HOWCOME @opera.com> Chris Lilley <CHRIS @w3.org> Ian Jacobs <IJ @w3.org This document is also available in these non-normative formats: plain text p.0, gzip'ed tar file p.0, ZIP FILEp.0, gzip'ed PostScript p.0, PDFp.0. See also translations. Copyright © 2016 W3C® (MIT, ERCIM, Keio, Beihang). W3C LIABILITY, TRADEMARK AND document use rules apply. Abstract This specification defines Cascading Style Sheets level 2. CSS is a style sheet language that allows au- thors and users to attach style (e.g., fonts and spacing) to structured documents (e.g., HTML documents and XML applications). By separating the presentation style of documents from the content of documents, CSS simplifies Web authoring and site maintenance. CSS 2.2 is the second revision of CSS level 2 [CSS2]p.363. It corrects a few errors in CSS 2.1, the first revision of CSS level 2. It is not the latest version of CSS. See the "CSS Snapshot" [CSS]p.363 for an overview of specifications that make up the whole of CSS.
    [Show full text]
  • Synchronized Multimedia Integration Language (SMIL) Boston Specification
    Synchronized Multimedia Integration Language (SMIL) Boston Specification Synchronized Multimedia Integration Language (SMIL) Boston Specification W3C Working Draft 25 February 2000 This version: http://www.w3.org/TR/2000/WD-smil-boston-20000225 (Other formats: single PostScript file, single PDF file, zip archive) Latest version: http://www.w3.org/TR/smil-boston Previous version: http://www.w3.org/TR/1999/WD-smil-boston-19991115 Editors: Jeff Ayars (RealNetworks), Dick Bulterman (Oratrix), Aaron Cohen (Intel), Erik Hodge (RealNetworks), Philipp Hoschka (W3C), Eric Hyche (RealNetworks), Ken Day (Macromedia), Kenichi Kubota (Panasonic), Rob Lanphier (RealNetworks), Nabil Layaïda (INRIA), Philippe Le Hégaret (W3C), Thierry Michel (W3C), Jacco van Ossenbruggen (CWI), Lloyd Rutledge (CWI), Bridie Saccocio (RealNetworks), Patrick Schmitz (Microsoft), Warner ten Kate (Philips), Ted Wugofski (Gateway). Copyright ©2000 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Abstract This document specifies the "Boston" version of the Synchronized Multimedia Integration Language (SMIL, pronounced "smile"). SMIL Boston has the following two design goals: Define a simple XML-based language that allows authors to write interactive multimedia presentations. Using SMIL Boston, an author can describe the temporal behavior of a multimedia presentation, associate hyperlinks with media objects and describe the layout of the presentation on a screen. Allow reusing of SMIL syntax and semantics in other XML-based languages, in particular those who need to represent timing and synchronization. For example, SMIL Boston components should be used for integrating timing into XHTML [XHTML10]. 1 24 Feb 2000 08:26 Synchronized Multimedia Integration Language (SMIL) Boston Specification Status of this document This section describes the status of this document at the time of its publication.
    [Show full text]
  • Design and Implementation of MEARN Stack-Based Real-Time Digital Signage System
    Journal of Korea Multimedia Society Vol. 20, No. 5, May 2017(pp. 808-826) https://doi.org/10.9717/kmms.2017.20.5.808 Design and Implementation of MEARN Stack-based Real-time Digital Signage System Trinh Duy Khue†, Thanh Binh Nguyen††, UkJIn Jang†, Chanbin Kim†, Sun-Tae Chung††† ABSTRACT Most of conventional DSS’s(Digital Signage Systems) have been built based on LAMP framework. Recent researches have shown that MEAN or MERN stack framework is simpler, more flexible, faster and more suitable for web-based application than LAMP stack framework. In this paper, we propose a design and implementation of MEARN (ME(A+R)N) stack-based real-time digital signage system, MR-DSS, which supports handing real-time tasks like urgent/instant messaging, system status monitoring and so on, efficiently in addition to conventional digital signage CMS service tasks. MR- DSCMS, CMS of MR-DSS, is designed to provide most of its normal services by REST APIs and real- time services like urgent/instant messaging by Socket.IO base under MEARN stack environment. In addition to architecture description of components composing MR-DSS, design and implementation issues are clarified in more detail. Through experimental testing, it is shown that 1) MR-DSS works functionally well, 2) the networking load performance of MR-DSCMS’s REST APIs is better compared to a well-known open source Xibo CMS, and 3) real-time messaging via Socket.IO works much faster than REST APIs. Key words: Digital Signage System, Content Management System, Real-time Web Service, MEAN Stack, MERN Stack, REST API, Socket.IO 1.
    [Show full text]
  • Beginning CSS: Cascading Style Sheets for Web Design
    www.GetPedia.com 01_576429 ffirs.qxd 11/18/04 12:25 PM Page iii Beginning CSS: Cascading Style Sheets for Web Design Richard York 01_576429 ffirs.qxd 11/18/04 12:25 PM Page i Beginning CSS: Cascading Style Sheets for Web Design 01_576429 ffirs.qxd 11/18/04 12:25 PM Page ii 01_576429 ffirs.qxd 11/18/04 12:25 PM Page iii Beginning CSS: Cascading Style Sheets for Web Design Richard York 01_576429 ffirs.qxd 11/18/04 12:25 PM Page iv Beginning CSS: Cascading Style Sheets for Web Design Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2005 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 0-7645-7642-9 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/QZ/RS/QU/IN No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, e-mail: [email protected].
    [Show full text]
  • Preview CSS Tutorial (PDF Version)
    About the Tutorial CSS is used to control the style of a web document in a simple and easy way. CSS stands for Cascading Style Sheets. This tutorial covers both the versions CSS1 and CSS2 and gives a complete understanding of CSS, starting from its basics to advanced concepts. Audience This tutorial will help both students as well as professionals who want to make their websites or personal blogs more attractive. Prerequisites You should be familiar with: Basic word processing using any text editor. How to create directories and files. How to navigate through different directories. Internet browsing using popular browsers like Internet Explorer or Firefox. Developing simple Web Pages using HTML or XHTML. If you are new to HTML and XHTML, then we would suggest you to go through our HTML Tutorial or XHTML Tutorial first. Copyright & Disclaimer Copyright 2017 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected] i Table of Contents About the Tutorial ....................................................................................................................................
    [Show full text]
  • CSS Preprocessing: Tools and Automation Techniques | HTML
    07/11/2019 Information | Free Full-Text | CSS Preprocessing: Tools and Automation Techniques | HTML Information 2018, 9(1), 17; https://doi.org/10.3390/info9010017 Article CSS Preprocessing: Tools and Automation Techniques † by Ricardo Queirós CRACS/INESC TEC and School of Media Arts and Design, Polytechnic of Porto, Rua D. Sancho I, n.° 981, 4480-876 Vila do Conde, Portugal † This paper is an extended version of our paper published in the 6th Symposium on Languages, Applications and Technologies (SLATE 2017), Porto, Portugal, 26–27 June 2017. Scientific Repository of the Polytechnic Institute of Porto Received: 12 Nprovidedo by vember 2017 / Accepted: 10 January 2018 / Published: 12 January 2018 View metadata, citation and similar papers at core.ac.uk CORE brought to you by Abstract: Cascading Style Sheets (CSS) is a W3C specification for a style sheet language used for describing the presentation of a document written in a markup language, more precisely, for styling Web documents. However, in the last few years, the landscape for CSS development has changed dramatically with the appearance of several languages and tools aiming to help developers build clean, modular and performance-aware CSS. These new approaches give developers mechanisms to preprocess CSS rules through the use of programming constructs, defined as CSS preprocessors, with the ultimate goal to bring those missing constructs to the CSS realm and to foster stylesheets structured programming. At the same time, a new set of tools appeared, defined as postprocessors, for extension and automation purposes covering a broad set of features ranging from identifying unused and duplicate code to applying vendor prefixes.
    [Show full text]
  • COMS W4115 Project Proposal Csslang
    COMS W4115 Project Proposal CSSLang Wayne Yang [email protected] June 6, 2010 1 Introduction In the past few years, there has been a growing trend of building web sites that comply with web standards to ensure greater accessibility, usability, and interoperability of web pages. These web standards commonly refer to Hypertex Markup Language (HTML), Cascading Style Sheets (CSS), and ECMAScript (or Javascript). CSS is a style sheet language primarily used to describe the presentations of web pages [1]. It enables the separation of presentation from the semantic or structure of web pages and allows web designers to reuse style sheets across web pages [2]. Throughout this document, the term "CSS" refers to the the CSS Level 2 Revision 1 (CSS 2.1) specification by W3C. Although CSS can also be ap- plied to XML documents, this project focuses on CSS in the HTML context. This project is to design a language CSSLang that adds features typically seen in programming languages to CSS. 2 Motivations Currently, CSS has no notion of variables which makes it diffcult for users to reuse style properties or create CSS rule sets that have parameterized property values. For example, to specify similar border and margin style for two class selectors header and footer, one has to duplicate style properties with slight variations in values: 1 #header { border-width: 1px; margin-width: 1px; } #footer { border-width: 5px; margin-width: 5px; } In addition, CSS lacks support for expressions in the property value such as the following: #header { border-width: 5px + 3em; } Inpsired by LESS and Sass which attempts to address these shortcomings of CSS, CSSLang implements some of the features and syntax of these lan- guages.
    [Show full text]