From bf621608c55870669fdd3dfad5caa5f104921e70 Mon Sep 17 00:00:00 2001 From: Peter Banka Date: Mon, 16 Dec 2019 16:17:37 -0800 Subject: [PATCH 1/2] WIP: Optionally include pre-flight styles - Current system *does not work*: the build creates a `tailwind.config.js` file properly, but that file does not influence whether or not preflight styles actually get included. Something seems to be wrong with respect to when the postcss/tailwind files are run versus when the `tailwind.config.js` file is processed. --- addon/styles/tailwind.config.js | 8 +++++--- ember-cli-build.js | 20 ++++++++++++++++++-- package.json | 1 + yarn.lock | 22 ++++++++++++++++++++++ 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/addon/styles/tailwind.config.js b/addon/styles/tailwind.config.js index cf8558b31..f0ddc970a 100644 --- a/addon/styles/tailwind.config.js +++ b/addon/styles/tailwind.config.js @@ -834,7 +834,9 @@ module.exports = { plugins: [], corePlugins: { - container: false - }, - + container: false, + // @ifdef NO_BASE_STYLES + preflight: false + // @endif + } }; diff --git a/ember-cli-build.js b/ember-cli-build.js index d9841df0d..0ee3a8bbb 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -4,6 +4,7 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); const Project = require('ember-cli/lib/models/project'); const MergeTrees = require('broccoli-merge-trees'); const Funnel = require('broccoli-funnel'); +const preprocess = require('broccoli-preprocess-tree'); module.exports = function(defaults) { let project = Project.closestSync(process.cwd()); @@ -43,9 +44,24 @@ module.exports = function(defaults) { filter: { enabled: false, plugins: [] - }, + } + } + }); + + let appTree = new Funnel(app.toTree(), { + exclude: ['addon/styles'] + }); + + let styles = preprocess('addon/styles', { + context: { + NO_BASE_STYLES: true }, + destDir: 'addon/styles' }); - return app.toTree(); + styles = new Funnel(styles, { destDir: 'addon/styles' }); + + appTree = new MergeTrees([appTree, styles]); + + return appTree; }; diff --git a/package.json b/package.json index 6376862e1..2e82c75d8 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "@ember/optional-features": "^1.0.0", "babel-eslint": "^10.0.3", "broccoli-asset-rev": "^3.0.0", + "broccoli-preprocess-tree": "^0.4.0", "chai": "^4.2.0", "common-tags": "^1.8.0", "ember-classy-page-object": "^0.5.0", diff --git a/yarn.lock b/yarn.lock index 3cd396c36..4fe918473 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3224,6 +3224,18 @@ broccoli-postcss@^5.0.0: object-assign "^4.1.1" postcss "^7.0.5" +broccoli-preprocess-tree@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/broccoli-preprocess-tree/-/broccoli-preprocess-tree-0.4.0.tgz#54440e29d829f721443ccfb6169520f6b73cf507" + integrity sha1-VEQOKdgp9yFEPM+2FpUg9rc89Qc= + dependencies: + broccoli-writer "^0.1.1" + copy-dereference "^1.0.0" + fs-extra "^0.30.0" + glob "^5.0.10" + lodash-node "^3.9.3" + preprocess "^2.1.1" + broccoli-replace@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/broccoli-replace/-/broccoli-replace-0.12.0.tgz#36460a984c45c61731638c53068b0ab12ea8fdb7" @@ -8582,6 +8594,11 @@ lodash-es@^4.17.11: resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78" integrity sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ== +lodash-node@^3.9.3: + version "3.10.2" + resolved "https://registry.yarnpkg.com/lodash-node/-/lodash-node-3.10.2.tgz#2598d5b1b54e6a68b4cb544e5c730953cbf632f7" + integrity sha1-JZjVsbVOami0y1ROXHMJU8v2Mvc= + lodash._baseassign@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" @@ -10354,6 +10371,11 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= +preprocess@^2.1.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/preprocess/-/preprocess-2.3.1.tgz#bda3022e623e9b599d4c0828186d85bd9f12c500" + integrity sha1-vaMCLmI+m1mdTAgoGG2FvZ8SxQA= + pretender@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/pretender/-/pretender-3.1.0.tgz#d8d7cc8502a9dbda82346ea399b9c63e7012f584" From 0f76446885a74f58afa5df52300f50c9e3f4ee16 Mon Sep 17 00:00:00 2001 From: Peter Banka Date: Wed, 18 Dec 2019 15:51:56 -0800 Subject: [PATCH 2/2] reinstate list-reset styles --- addon/components/api/x-toggles/template.hbs | 2 +- addon/components/docs-header/search-results/template.hbs | 2 +- addon/components/docs-header/version-selector/template.hbs | 2 +- addon/components/docs-viewer/x-current-page-index/template.hbs | 2 +- addon/components/docs-viewer/x-nav-list/component.js | 2 ++ 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addon/components/api/x-toggles/template.hbs b/addon/components/api/x-toggles/template.hbs index a7c36d430..12f67c86a 100644 --- a/addon/components/api/x-toggles/template.hbs +++ b/addon/components/api/x-toggles/template.hbs @@ -1,4 +1,4 @@ -