0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

50
web/node_modules/css-declaration-sorter/changelog.md generated vendored Normal file
View file

@ -0,0 +1,50 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and follows [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [4.0.1] - 2018-07-30
### Fixed
- Invalid package engines node version range.
## [4.0.0] - 2018-07-24
### Added
- New flex box shorthand properties which can conflict with existing flex box properties.
- New ruby, transform and text related properties.
### Removed
- Node 4 support.
- Deprecated grid properties.
## [3.0.1] - 2018-01-11
### Fixed
- Keep at-rules at the same position.
## [3.0.0] - 2017-12-14
### Added
- Flexbox justify self properties.
### Changed
- SMACSS order so it is more in line with Stylelint.
### Removed
- Command line interface in favor of [postcss-cli](https://github.com/postcss/postcss-cli).
## [2.1.0] - 2017-08-25
### Added
- New text style and interaction related properties.
## [2.0.1] - 2017-06-19
### Fixed
- Prevent comments outside CSS selectors from being moved.
## [2.0.0] - 2017-03-16
### Changed
- Put declarations before nested declarations.
[4.0.1]: https://github.com/Siilwyn/css-declaration-sorter/compare/v4.0.0...v4.0.1
[4.0.0]: https://github.com/Siilwyn/css-declaration-sorter/compare/v3.0.1...v4.0.0
[3.0.1]: https://github.com/Siilwyn/css-declaration-sorter/compare/v3.0.0...v3.0.1
[3.0.0]: https://github.com/Siilwyn/css-declaration-sorter/compare/v2.1.0...v3.0.0
[2.1.0]: https://github.com/Siilwyn/css-declaration-sorter/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/Siilwyn/css-declaration-sorter/compare/v2.0.1...v2.0.0
[2.0.0]: https://github.com/Siilwyn/css-declaration-sorter/compare/v1.7.1...v2.0.0

20
web/node_modules/css-declaration-sorter/license.md generated vendored Normal file
View file

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright 2016 Selwyn <talk@selwyn.cc>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,299 @@
[
"all",
"display",
"position",
"top",
"right",
"bottom",
"left",
"offset-inline-start",
"offset-inline-end",
"offset-block-start",
"offset-block-end",
"grid",
"grid-area",
"grid-auto-columns",
"grid-auto-flow",
"grid-auto-rows",
"grid-column",
"grid-column-end",
"grid-column-start",
"grid-row",
"grid-row-end",
"grid-row-start",
"grid-template",
"grid-template-areas",
"grid-template-columns",
"grid-template-rows",
"flex",
"flex-basis",
"flex-direction",
"flex-flow",
"flex-grow",
"flex-shrink",
"flex-wrap",
"box-decoration-break",
"place-content",
"place-items",
"place-self",
"align-content",
"align-items",
"align-self",
"justify-content",
"justify-items",
"justify-self",
"vertical-align",
"order",
"float",
"clear",
"shape-margin",
"shape-outside",
"shape-image-threshold",
"orphans",
"columns",
"column-gap",
"column-fill",
"column-rule",
"column-rule-color",
"column-rule-style",
"column-rule-width",
"column-span",
"column-count",
"column-width",
"break-before",
"break-after",
"break-inside",
"page-break-before",
"page-break-after",
"page-break-inside",
"transform",
"transform-box",
"transform-origin",
"transform-style",
"rotate",
"scale",
"perspective",
"perspective-origin",
"visibility",
"opacity",
"z-index",
"mix-blend-mode",
"backface-visibility",
"backdrop-filter",
"clip-path",
"mask",
"mask-clip",
"mask-image",
"mask-origin",
"mask-position",
"mask-repeat",
"mask-size",
"mask-type",
"filter",
"animation",
"animation-name",
"animation-duration",
"animation-fill-mode",
"animation-play-state",
"animation-timing-function",
"animation-delay",
"animation-iteration-count",
"animation-direction",
"transition",
"transition-delay",
"transition-duration",
"transition-property",
"transition-timing-function",
"will-change",
"counter-increment",
"counter-reset",
"cursor",
"box-sizing",
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left",
"margin-inline-start",
"margin-inline-end",
"margin-block-start",
"margin-block-end",
"outline",
"outline-color",
"outline-offset",
"outline-style",
"outline-width",
"box-shadow",
"border",
"border-top",
"border-right",
"border-bottom",
"border-left",
"border-width",
"border-top-width",
"border-right-width",
"border-bottom-width",
"border-left-width",
"border-style",
"border-top-style",
"border-right-style",
"border-bottom-style",
"border-left-style",
"border-radius",
"border-top-right-radius",
"border-top-left-radius",
"border-bottom-right-radius",
"border-bottom-left-radius",
"border-color",
"border-top-color",
"border-right-color",
"border-bottom-color",
"border-left-color",
"border-inline-start",
"border-inline-start-color",
"border-inline-start-style",
"border-inline-start-width",
"border-inline-end",
"border-inline-end-color",
"border-inline-end-style",
"border-inline-end-width",
"border-block-start",
"border-block-start-color",
"border-block-start-style",
"border-block-start-width",
"border-block-end",
"border-block-end-color",
"border-block-end-style",
"border-block-end-width",
"border-image",
"border-image-outset",
"border-image-repeat",
"border-image-slice",
"border-image-source",
"border-image-width",
"border-collapse",
"border-spacing",
"background",
"background-attachment",
"background-blend-mode",
"background-clip",
"background-color",
"background-image",
"background-origin",
"background-position",
"background-position-x",
"background-position-y",
"background-repeat",
"background-size",
"isolation",
"padding",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
"padding-inline-start",
"padding-inline-end",
"padding-block-start",
"padding-block-end",
"image-orientation",
"image-rendering",
"width",
"min-width",
"max-width",
"height",
"min-height",
"max-height",
"inline-size",
"min-inline-size",
"max-inline-size",
"block-size",
"min-block-size",
"max-block-size",
"table-layout",
"caption-side",
"empty-cells",
"overflow",
"overflow-x",
"overflow-y",
"resize",
"object-fit",
"object-position",
"scroll-behavior",
"scroll-snap-coordinate",
"scroll-snap-destination",
"scroll-snap-type",
"touch-action",
"pointer-events",
"ruby-align",
"ruby-position",
"color",
"caret-color",
"font",
"font-family",
"font-feature-settings",
"font-kerning",
"font-language-override",
"font-size",
"font-optical-sizing",
"font-size-adjust",
"font-stretch",
"font-style",
"font-synthesis",
"font-variant",
"font-variant-alternates",
"font-variant-caps",
"font-variant-east-asian",
"font-variant-ligatures",
"font-variant-numeric",
"font-variant-position",
"font-weight",
"hyphens",
"initial-letter",
"initial-letter-align",
"letter-spacing",
"line-break",
"line-height",
"list-style",
"list-style-image",
"list-style-position",
"list-style-type",
"writing-mode",
"direction",
"unicode-bidi",
"unicode-range",
"user-select",
"text-combine-upright",
"text-align",
"text-align-last",
"text-decoration",
"text-decoration-color",
"text-decoration-line",
"text-decoration-skip",
"text-decoration-style",
"text-decoration-skip-ink",
"text-emphasis",
"text-emphasis-position",
"text-emphasis-color",
"text-emphasis-style",
"text-indent",
"text-justify",
"text-underline-position",
"text-orientation",
"text-overflow",
"text-rendering",
"text-shadow",
"text-size-adjust",
"text-transform",
"white-space",
"word-break",
"word-spacing",
"overflow-wrap",
"quotes",
"tab-size",
"content",
"widows"
]

View file

@ -0,0 +1,299 @@
[
"box-sizing",
"display",
"visibility",
"z-index",
"position",
"top",
"right",
"bottom",
"left",
"offset-inline-start",
"offset-inline-end",
"offset-block-start",
"offset-block-end",
"grid",
"grid-area",
"grid-auto-columns",
"grid-auto-flow",
"grid-auto-rows",
"grid-column",
"grid-column-end",
"grid-column-start",
"grid-row",
"grid-row-end",
"grid-row-start",
"grid-template",
"grid-template-areas",
"grid-template-columns",
"grid-template-rows",
"flex",
"flex-basis",
"flex-direction",
"flex-flow",
"flex-grow",
"flex-shrink",
"flex-wrap",
"box-decoration-break",
"place-content",
"place-items",
"place-self",
"align-content",
"align-items",
"align-self",
"justify-content",
"justify-items",
"justify-self",
"order",
"width",
"min-width",
"max-width",
"height",
"min-height",
"max-height",
"inline-size",
"min-inline-size",
"max-inline-size",
"block-size",
"min-block-size",
"max-block-size",
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left",
"margin-inline-start",
"margin-inline-end",
"margin-block-start",
"margin-block-end",
"padding",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
"padding-inline-start",
"padding-inline-end",
"padding-block-start",
"padding-block-end",
"float",
"clear",
"overflow",
"overflow-x",
"overflow-y",
"orphans",
"columns",
"column-gap",
"column-fill",
"column-rule",
"column-rule-color",
"column-rule-style",
"column-rule-width",
"column-span",
"column-count",
"column-width",
"object-fit",
"object-position",
"transform",
"transform-box",
"transform-origin",
"transform-style",
"rotate",
"scale",
"border",
"border-top",
"border-right",
"border-bottom",
"border-left",
"border-width",
"border-top-width",
"border-right-width",
"border-bottom-width",
"border-left-width",
"border-style",
"border-top-style",
"border-right-style",
"border-bottom-style",
"border-left-style",
"border-radius",
"border-top-right-radius",
"border-top-left-radius",
"border-bottom-right-radius",
"border-bottom-left-radius",
"border-inline-start",
"border-inline-start-color",
"border-inline-start-style",
"border-inline-start-width",
"border-inline-end",
"border-inline-end-color",
"border-inline-end-style",
"border-inline-end-width",
"border-block-start",
"border-block-start-color",
"border-block-start-style",
"border-block-start-width",
"border-block-end",
"border-block-end-color",
"border-block-end-style",
"border-block-end-width",
"border-color",
"border-image",
"border-image-outset",
"border-image-repeat",
"border-image-slice",
"border-image-source",
"border-image-width",
"border-top-color",
"border-right-color",
"border-bottom-color",
"border-left-color",
"border-collapse",
"border-spacing",
"outline",
"outline-color",
"outline-offset",
"outline-style",
"outline-width",
"backdrop-filter",
"backface-visibility",
"background",
"background-attachment",
"background-blend-mode",
"background-clip",
"background-color",
"background-image",
"background-origin",
"background-position",
"background-position-x",
"background-position-y",
"background-repeat",
"background-size",
"box-shadow",
"isolation",
"ruby-align",
"ruby-position",
"color",
"caret-color",
"font",
"font-family",
"font-feature-settings",
"font-kerning",
"font-language-override",
"font-size",
"font-optical-sizing",
"font-size-adjust",
"font-stretch",
"font-style",
"font-synthesis",
"font-variant",
"font-variant-alternates",
"font-variant-caps",
"font-variant-east-asian",
"font-variant-ligatures",
"font-variant-numeric",
"font-variant-position",
"font-weight",
"hyphens",
"initial-letter",
"initial-letter-align",
"letter-spacing",
"line-break",
"line-height",
"list-style",
"list-style-image",
"list-style-position",
"list-style-type",
"direction",
"text-align",
"text-align-last",
"text-decoration",
"text-decoration-color",
"text-decoration-line",
"text-decoration-skip",
"text-decoration-style",
"text-decoration-skip-ink",
"text-emphasis",
"text-emphasis-position",
"text-emphasis-color",
"text-emphasis-style",
"text-indent",
"text-justify",
"text-underline-position",
"text-orientation",
"text-overflow",
"text-rendering",
"text-shadow",
"text-size-adjust",
"text-transform",
"vertical-align",
"white-space",
"word-break",
"word-spacing",
"overflow-wrap",
"all",
"animation",
"animation-name",
"animation-duration",
"animation-fill-mode",
"animation-play-state",
"animation-timing-function",
"animation-delay",
"animation-iteration-count",
"animation-direction",
"mix-blend-mode",
"break-before",
"break-after",
"break-inside",
"page-break-before",
"page-break-after",
"page-break-inside",
"caption-side",
"clip-path",
"content",
"counter-increment",
"counter-reset",
"cursor",
"empty-cells",
"filter",
"image-orientation",
"image-rendering",
"mask",
"mask-clip",
"mask-image",
"mask-origin",
"mask-position",
"mask-repeat",
"mask-size",
"mask-type",
"opacity",
"perspective",
"perspective-origin",
"pointer-events",
"quotes",
"resize",
"scroll-behavior",
"scroll-snap-coordinate",
"scroll-snap-destination",
"scroll-snap-type",
"shape-image-threshold",
"shape-margin",
"shape-outside",
"tab-size",
"table-layout",
"text-combine-upright",
"touch-action",
"transition",
"transition-delay",
"transition-duration",
"transition-property",
"transition-timing-function",
"will-change",
"unicode-bidi",
"unicode-range",
"user-select",
"widows",
"writing-mode"
]

View file

@ -0,0 +1,295 @@
[
"align-content",
"align-items",
"align-self",
"all",
"animation",
"animation-delay",
"animation-direction",
"animation-duration",
"animation-fill-mode",
"animation-iteration-count",
"animation-name",
"animation-play-state",
"animation-timing-function",
"backdrop-filter",
"backface-visibility",
"background",
"background-attachment",
"background-blend-mode",
"background-clip",
"background-color",
"background-image",
"background-origin",
"background-position",
"background-position-x",
"background-position-y",
"background-repeat",
"background-size",
"block-size",
"border",
"border-block-end",
"border-block-end-color",
"border-block-end-style",
"border-block-end-width",
"border-block-start",
"border-block-start-color",
"border-block-start-style",
"border-block-start-width",
"border-bottom",
"border-bottom-color",
"border-bottom-left-radius",
"border-bottom-right-radius",
"border-bottom-style",
"border-bottom-width",
"border-collapse",
"border-color",
"border-image",
"border-image-outset",
"border-image-repeat",
"border-image-slice",
"border-image-source",
"border-image-width",
"border-inline-end",
"border-inline-end-color",
"border-inline-end-style",
"border-inline-end-width",
"border-inline-start",
"border-inline-start-color",
"border-inline-start-style",
"border-inline-start-width",
"border-left",
"border-left-color",
"border-left-style",
"border-left-width",
"border-radius",
"border-right",
"border-right-color",
"border-right-style",
"border-right-width",
"border-spacing",
"border-style",
"border-top",
"border-top-color",
"border-top-left-radius",
"border-top-right-radius",
"border-top-style",
"border-top-width",
"border-width",
"bottom",
"box-decoration-break",
"box-shadow",
"box-sizing",
"break-after",
"break-before",
"break-inside",
"caption-side",
"caret-color",
"clear",
"clip-path",
"color",
"column-count",
"column-fill",
"column-gap",
"column-rule",
"column-rule-color",
"column-rule-style",
"column-rule-width",
"column-span",
"column-width",
"columns",
"content",
"counter-increment",
"counter-reset",
"cursor",
"direction",
"display",
"empty-cells",
"filter",
"flex",
"flex-basis",
"flex-direction",
"flex-flow",
"flex-grow",
"flex-shrink",
"flex-wrap",
"float",
"font",
"font-family",
"font-feature-settings",
"font-kerning",
"font-language-override",
"font-optical-sizing",
"font-size",
"font-size-adjust",
"font-stretch",
"font-style",
"font-synthesis",
"font-variant",
"font-variant-alternates",
"font-variant-caps",
"font-variant-east-asian",
"font-variant-ligatures",
"font-variant-numeric",
"font-variant-position",
"font-weight",
"grid",
"grid-area",
"grid-auto-columns",
"grid-auto-flow",
"grid-auto-rows",
"grid-column",
"grid-column-end",
"grid-column-start",
"grid-row",
"grid-row-end",
"grid-row-start",
"grid-template",
"grid-template-areas",
"grid-template-columns",
"grid-template-rows",
"height",
"hyphens",
"image-orientation",
"image-rendering",
"initial-letter",
"initial-letter-align",
"inline-size",
"isolation",
"justify-content",
"justify-items",
"justify-self",
"left",
"letter-spacing",
"line-break",
"line-height",
"list-style",
"list-style-image",
"list-style-position",
"list-style-type",
"margin",
"margin-block-end",
"margin-block-start",
"margin-bottom",
"margin-inline-end",
"margin-inline-start",
"margin-left",
"margin-right",
"margin-top",
"mask",
"mask-clip",
"mask-image",
"mask-origin",
"mask-position",
"mask-repeat",
"mask-size",
"mask-type",
"max-block-size",
"max-height",
"max-inline-size",
"max-width",
"min-block-size",
"min-height",
"min-inline-size",
"min-width",
"mix-blend-mode",
"object-fit",
"object-position",
"offset-block-end",
"offset-block-start",
"offset-inline-end",
"offset-inline-start",
"opacity",
"order",
"orphans",
"outline",
"outline-color",
"outline-offset",
"outline-style",
"outline-width",
"overflow",
"overflow-wrap",
"overflow-x",
"overflow-y",
"padding",
"padding-block-end",
"padding-block-start",
"padding-bottom",
"padding-inline-end",
"padding-inline-start",
"padding-left",
"padding-right",
"padding-top",
"page-break-after",
"page-break-before",
"page-break-inside",
"perspective",
"perspective-origin",
"place-content",
"place-items",
"place-self",
"pointer-events",
"position",
"quotes",
"resize",
"right",
"rotate",
"ruby-align",
"ruby-position",
"scale",
"scroll-behavior",
"scroll-snap-coordinate",
"scroll-snap-destination",
"scroll-snap-type",
"shape-image-threshold",
"shape-margin",
"shape-outside",
"tab-size",
"table-layout",
"text-align",
"text-align-last",
"text-combine-upright",
"text-decoration",
"text-decoration-color",
"text-decoration-line",
"text-decoration-skip",
"text-decoration-skip-ink",
"text-decoration-style",
"text-emphasis",
"text-emphasis-color",
"text-emphasis-position",
"text-emphasis-style",
"text-indent",
"text-justify",
"text-orientation",
"text-overflow",
"text-rendering",
"text-shadow",
"text-size-adjust",
"text-transform",
"text-underline-position",
"top",
"touch-action",
"transform",
"transform-box",
"transform-origin",
"transform-style",
"transition",
"transition-delay",
"transition-duration",
"transition-property",
"transition-timing-function",
"unicode-bidi",
"unicode-range",
"user-select",
"vertical-align",
"visibility",
"white-space",
"widows",
"width",
"will-change",
"word-break",
"word-spacing",
"writing-mode",
"z-index"
]

45
web/node_modules/css-declaration-sorter/package.json generated vendored Normal file
View file

@ -0,0 +1,45 @@
{
"name": "css-declaration-sorter",
"version": "4.0.1",
"description": "Sorts CSS declarations fast and automatically in a certain order.",
"main": "src/index.js",
"files": [
"src/index.js",
"orders"
],
"scripts": {
"test": "node tests/test.js",
"test:benchmark": "node tests/benchmark/benchmark.js",
"test:ci": "npm test && npm run lint -- --max-warnings 0",
"lint": "eslint src/*.js tests/*.js",
"preversion": "npm test",
"scrape": "node src/property-scraper"
},
"dependencies": {
"postcss": "^7.0.1",
"timsort": "^0.3.0"
},
"devDependencies": {
"benchmark": "^2.1.4",
"eslint": "^5.0.0",
"tape": "^4.2.1"
},
"engines": {
"node": ">4"
},
"repository": {
"type": "git",
"url": "https://github.com/Siilwyn/css-declaration-sorter.git"
},
"author": "Selwyn <talk@selwyn.cc> (https://selwyn.cc/)",
"license": "MIT",
"keywords": [
"postcss",
"postcss-plugin",
"css",
"declaration",
"sorter",
"property",
"order"
]
}

112
web/node_modules/css-declaration-sorter/readme.md generated vendored Normal file
View file

@ -0,0 +1,112 @@
<img alt='CSS declaration sorter logo' src='https://cdn.rawgit.com/Siilwyn/css-declaration-sorter/master/logo.svg' height='260' align='right'>
# CSS Declaration Sorter
[![Travis Build Status][travis-icon]][travis]
[![npm version][npm-icon]][npm]
[![David Dependencies Status][david-icon]][david]
[![David devDependencies Status][david-dev-icon]][david-dev]
A Node.js module and [PostCSS] plugin to sort CSS declarations based on their property names. Ensuring the CSS is organized, more consistent and in order... Besides, sorted CSS is smaller when gzipped because there will be more similar strings. The intention of this module is to sort the source CSS code of a project in the build process. Check out [the Atom package](https://github.com/Siilwyn/css-declaration-sorter-atom) for individual usage.
## Alphabetical example
Input:
```css
body {
display: block;
animation: none;
color: #C55;
border: 0;
}
```
Output:
```css
body {
animation: none;
border: 0;
color: #C55;
display: block;
}
```
## Niceness
- Up-to-date CSS properties fetched from the [MDN Web Platform](https://developer.mozilla.org/).
- Sort using your own defined order.
- Nested rules sorting support.
- Less and SCSS support when combined with either [postcss-scss](https://github.com/postcss/postcss-scss) or [postcss-less](https://github.com/webschik/postcss-less).
- Thought-out sorting orders out of the box, **approved by their authors**.
## Sorting orders
- Alphabetically
`alphabetically`
*Default, ordering in a simple alphabetical manner from a - z.*
- [SMACSS](https://smacss.com/book/formatting#grouping)
`smacss`
*Ordering from most important, flow affecting properties, to least important properties.*
- Box
- Border
- Background
- Text
- Other
- [Concentric CSS](https://github.com/brandon-rhodes/Concentric-CSS)
`concentric-css`
*Starts outside the box model, moves inward.*
- Positioning
- Visibility
- Box model
- Dimensions
- Text
- Custom order
*Provide your own order by passing the location of a JSON file containing an array.*
## Usage
`npm install css-declaration-sorter --save-dev`
### CLI
This module does not include its own CLI but works with the official [PostCSS CLI](https://github.com/postcss/postcss-cli). To use the examples below, install `postcss-cli` or prefix with `npx`.
Piping out result from file:
`postcss input.css --use css-declaration-sorter | cat`
Sorting multiple files by overwriting:
`postcss *.css --use css-declaration-sorter --replace --no-map`
### Vanilla JS
```js
const fs = require('fs');
const postcss = require('postcss');
const cssDeclarationSorter = require('css-declaration-sorter');
postcss([cssDeclarationSorter({order: 'smacss'})])
.process(fs.readFileSync('some.css'))
.then(function (result) {
fs.writeFileSync('some.css', result.css);
});
```
### Gulp
```js
const gulp = require('gulp');
const gulpPostcss = require('gulp-postcss');
const cssDeclarationSorter = require('css-declaration-sorter');
gulp.task('css', function () {
return gulp.src('some.css')
.pipe(gulpPostcss([cssDeclarationSorter({order: 'smacss'})]))
.pipe(gulp.dest('./'));
});
```
See [PostCSS] documentation for more examples and other environments.
[PostCSS]: https://github.com/postcss/postcss
[travis]: https://travis-ci.org/Siilwyn/css-declaration-sorter
[travis-icon]: https://img.shields.io/travis/Siilwyn/css-declaration-sorter/master.svg?style=flat-square
[npm]: https://npmjs.com/css-declaration-sorter
[npm-icon]: https://img.shields.io/npm/v/css-declaration-sorter.svg?style=flat-square
[david]: https://david-dm.org/Siilwyn/css-declaration-sorter
[david-icon]: https://img.shields.io/david/Siilwyn/css-declaration-sorter.svg?style=flat-square
[david-dev]: https://david-dm.org/Siilwyn/css-declaration-sorter?type=dev
[david-dev-icon]: https://img.shields.io/david/dev/Siilwyn/css-declaration-sorter.svg?style=flat-square

131
web/node_modules/css-declaration-sorter/src/index.js generated vendored Normal file
View file

@ -0,0 +1,131 @@
'use strict';
const fs = require('fs');
const path = require('path');
const postcss = require('postcss');
const timsort = require('timsort').sort;
module.exports = postcss.plugin('css-declaration-sorter', function (options) {
return function (css) {
let sortOrderPath;
options = options || {};
// Use included sorting order if order is passed and not alphabetically
if (options.order && options.order !== 'alphabetically') {
sortOrderPath = path.join(__dirname, '../orders/', options.order) + '.json';
} else if (options.customOrder) {
sortOrderPath = options.customOrder;
} else {
// Fallback to the default sorting order
return processCss(css, 'alphabetically');
}
// Load in the array containing the order from a JSON file
return new Promise(function (resolve, reject) {
fs.readFile(sortOrderPath, function (error, data) {
if (error) return reject(error);
resolve(data);
});
}).then(function (data) {
return processCss(css, JSON.parse(data));
});
};
});
function processCss (css, sortOrder) {
const comments = [];
const rulesCache = [];
css.walk(function (node) {
const nodes = node.nodes;
const type = node.type;
if (type === 'comment') {
// Don't do anything to root comments or the last newline comment
const isNewlineNode = ~node.raws.before.indexOf('\n');
const lastNewlineNode = isNewlineNode && !node.next();
const onlyNode = !node.prev() && !node.next();
if (lastNewlineNode || onlyNode || node.parent.type === 'root') {
return;
}
if (isNewlineNode) {
const pairedNode = node.next() ? node.next() : node.prev().prev();
if (pairedNode) {
comments.unshift({
'comment': node,
'pairedNode': pairedNode,
'insertPosition': node.next() ? 'Before' : 'After',
});
node.remove();
}
} else {
const pairedNode = node.prev() ? node.prev() : node.next().next();
if (pairedNode) {
comments.push({
'comment': node,
'pairedNode': pairedNode,
'insertPosition': 'After',
});
node.remove();
}
}
return;
}
// Add rule-like nodes to a cache so that we can remove all
// comment nodes before we start sorting.
const isRule = type === 'rule' || type === 'atrule';
if (isRule && nodes && nodes.length > 1) {
rulesCache.push(nodes);
}
});
// Perform a sort once all comment nodes are removed
rulesCache.forEach(function (nodes) {
sortCssDecls(nodes, sortOrder);
});
// Add comments back to the nodes they are paired with
comments.forEach(function (node) {
const pairedNode = node.pairedNode;
node.comment.remove();
pairedNode.parent['insert' + node.insertPosition](pairedNode, node.comment);
});
}
// Sort CSS declarations alphabetically or using the set sorting order
function sortCssDecls (cssDecls, sortOrder) {
if (sortOrder === 'alphabetically') {
timsort(cssDecls, function (a, b) {
if (a.type === 'decl' && b.type === 'decl') {
return comparator(a.prop, b.prop);
} else {
return compareDifferentType(a, b);
}
});
} else {
timsort(cssDecls, function (a, b) {
if (a.type === 'decl' && b.type === 'decl') {
const aIndex = sortOrder.indexOf(a.prop);
const bIndex = sortOrder.indexOf(b.prop);
return comparator(aIndex, bIndex);
} else {
return compareDifferentType(a, b);
}
});
}
}
function comparator (a, b) {
return a === b ? 0 : a < b ? -1 : 1;
}
function compareDifferentType (a, b) {
if (b.type === 'atrule') { return 0; }
return (a.type === 'decl') ? -1 : (b.type === 'decl') ? 1 : 0;
}