Sass files sit at assets-src/styles/sass and are split across a series of numbered directories. The lower the number the more generic the styles, the higher the number the more explicit. As the directories increase, so does the specificity. If the contents of a directory are not needed, they can be excluded. New levels (and files) can be added as required.
@font-face rules for custom web fonts, which we prefer to self-host.
- Sass variables which are referenced elsewhere within Amplify:
- breakpoints for CSS media queries
- colours
- typesetting (system fonts, web fonts, monospaced font family, font weights)
- A setting for debugging CSS layouts. Change from
falsetotrueand rebuild the styles to enable.
- Sass functions such as em/rem calculation, removing units to return a plain number value.
- Sass mixins to manage font sizes, viewport media queries and vertical spacing within and between components.
Default styles forming the base of your project, including global styles like:
- typography and spacing
- buttons and links
- lists
- forms and form error messages
- tables
This is also where the starter print styles live.
Heavily influenced by Every Layout, these are styles for the basic layout helpers, which can be combined and customised to make a variety of components and page templates.
The basic components available for use, as they will appear in the absence of any JavaScript.
Components that are enhanced in some way with JavaScript.
Styles needed for the various JS-enhanced navigation patterns provided by Amplify.
Styles for any functionality coming from external, third party sources.
Amplify overrides to vendor styles.
If your project requires styles for specific page templates and/or content types, you should create this directory and add those styles here. Note the directory 85-amplify which holds all the styles specific to the Amplify website.
Targeted override and helper classes.
Amplify uses Stylelint to help us avoid errors and enforce conventions in our CSS. Visit that site for detailed documentation.
If Stylelint encounters any errors that it cannot automatically fix, they will be highlighted in the terminal window and the Sass compilation step will not run. You must then either manually resolve the errors (preferred), or tell Stylelint to ignore the problematic code.
If you have to ignore code for a valid reason, you must specify the reason within the ignore comment. You are encouraged to discuss with another developer before ignoring code.
Do not modify the underlying Stylelint rulesets found in the stylelint.config.js config file without first discussing with the developers responsible for maintaining Amplify.
Amplify uses the Node implementation of Dart Sass to parse .scss files in assets-src/styles/sass into three CSS stylesheets in web/dist/styles:
core.cssprint.cssadvanced.css
PostCSS, PostCSS CLI and Autoprefixer NPM packages add any vendor prefixes which may be required for our supported list of browsers and produce minified versions of these stylesheets.
Both core.css and print.css are served to all browsers. advanced.css is only served to supported browsers.
The files core.scss, print.scss and advanced.scss within assets-src/styles determine which Sass files will be compiled into the relevant CSS stylesheet. The individual Sass partials are included using the @import directive in the order denoted by the level in which they reside, remembering the impact of the CSS cascade. Any partials found to be unnecessary for a specific project - such as those needed for the Amplify site - should be commented out, to reduce the size of the compiled CSS files.
- Reset and base styles
- Layouts
- Core component styles
- Template-specific styles
- Utility classes
Some default print styles are included, but developers must check and add any further styles required for a legible print presentation.
- Advanced component styles
- Vendor (third party) styles relating to JavaScript enhancements
- Amplify overrides to vendor styles
Any entry within these files that is commented out will not be part of the compiled CSS. It's suggested to do this, rather than deleting Sass partials from assets-src/styles/sass.