Skip to content

Commit

Permalink
Docs(playground): added preset-lite to playground
Browse files Browse the repository at this point in the history
  • Loading branch information
anikethsaha committed Aug 24, 2020
1 parent 132526b commit 434e34d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
1 change: 1 addition & 0 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"classnames": "^2.2.6",
"cssnano-preset-advanced": "^4.0.7",
"cssnano-preset-default": "^4.0.7",
"cssnano-preset-lite": "^1.0.0",
"postcss": "^7.0.16",
"prettier": "^2.0.4",
"react": "^16.8.4",
Expand Down
1 change: 1 addition & 0 deletions site/src/components/editor/postcss_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { pkgnameToVarName } from '../../helper/naming';
const moduleMap = {
cssnanoPresetDefault: require('cssnano-preset-default'),
cssnanoPresetAdvanced: require('cssnano-preset-advanced'),
cssnanoPresetLite: require('cssnano-preset-lite'),
};

function initializePlugin(plugin, css, result) {
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/editor/snippets/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default `// cssnano config
{
"preset" : "default",
"preset" : "default"
}
`;
15 changes: 7 additions & 8 deletions site/src/pages/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ export default () => {
// show the loading. editor panel loader not each editor's loader
setEditorLoading(true);
const configToSend = JSON.parse(
JSON.stringify(
config
.split('\n')
.slice(1)
.join('\n')
)
JSON.stringify(config.split('\n').slice(1).join('\n'))
);

const resolvedConfig = resolveConfigs(configToSend);
Expand Down Expand Up @@ -120,14 +115,18 @@ export default () => {
return [
playgroundConfig.preset[0] === 'advance'
? 'cssnano-preset-advance'
: 'cssnano-preset-default',
: playgroundConfig.preset[0] === 'default'
? 'cssnano-preset-default'
: 'cssnano-preset-lite',
playgroundConfig.preset.length > 1 ? playgroundConfig.preset[1] : {},
];
}
[
playgroundConfig.preset === 'advance'
? 'cssnano-preset-advance'
: 'cssnano-preset-default',
: playgroundConfig.preset === 'default'
? 'cssnano-preset-default'
: 'cssnano-preset-lite',
{},
];
} else {
Expand Down
18 changes: 18 additions & 0 deletions site/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3194,6 +3194,17 @@ cssnano-preset-default@^4.0.7:
postcss-svgo "^4.0.2"
postcss-unique-selectors "^4.0.1"

cssnano-preset-lite@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/cssnano-preset-lite/-/cssnano-preset-lite-1.0.0.tgz#c6be680fdd2c39c71c54aecfdf84a99c13fd186e"
integrity sha512-Gjh9zi39+PAUS6XHPiQF6ff+XtPilnmrHa2HlvXcS4ryxVT2uh/2zHyZTLpyYrvwIG4BD8pEDqGRbIWMRqKcew==
dependencies:
cssnano-utils "^1.0.0"
postcss "^7.0.16"
postcss-discard-comments "^4.0.2"
postcss-discard-empty "^4.0.1"
postcss-normalize-whitespace "^4.0.2"

cssnano-util-get-arguments@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz#ed3a08299f21d75741b20f3b81f194ed49cc150f"
Expand All @@ -3216,6 +3227,13 @@ cssnano-util-same-parent@^4.0.0:
resolved "https://registry.yarnpkg.com/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz#574082fb2859d2db433855835d9a8456ea18bbf3"
integrity sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q==

cssnano-utils@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/cssnano-utils/-/cssnano-utils-1.0.0.tgz#d3c2dc0aaae941c50d0e3b97be0c5e4c96cdc6a4"
integrity sha512-NPGCCEvAPD4fphgHPPWVGYT22C+1rnw0S0W+SLhVnmiTaPhLtyY6e0uz0Fh7NtpQLrX/LpIjFV5lGHqSMTA3bQ==
dependencies:
postcss "^7.0.16"

cssnano@^4.1.10:
version "4.1.10"
resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-4.1.10.tgz#0ac41f0b13d13d465487e111b778d42da631b8b2"
Expand Down

0 comments on commit 434e34d

Please sign in to comment.