Skip to content

Commit

Permalink
step 2: remove the post-css process entirely to ease migration to v2 …
Browse files Browse the repository at this point in the history
…addon
  • Loading branch information
BlueCutOfficial committed Feb 1, 2024
1 parent 19e6a63 commit 6270e91
Show file tree
Hide file tree
Showing 4 changed files with 4,938 additions and 2,335 deletions.
24 changes: 1 addition & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,29 +200,7 @@ custom animations.

### CSS Variables

⚠️ This functionality will be removed in 5.0.0, checkout the [DEPRECATIONS.md]('https://github.com/mainmatter/ember-promise-modals/blob/main/DEPRECATIONS.md#postcss-process) guide.

The addons CSS is run through PostCSS by default, which will create static
fallbacks for all custom properties using their defaults.

If your application uses PostCSS by itself, you can set `excludeCSS` to `true`
inside your `ember-cli-build.js`:

```js
let app = new EmberAddon(defaults, {
// Add options here
'ember-promise-modals': {
excludeCSS: true,
},
});
```

Done that, you can use [postcss-import](https://github.com/postcss/postcss-import)
to import the uncompiled addon styles in your projects `app/styles/app.css`:

```css
@import 'ember-promise-modals';
```
The addons CSS relies on CSS variables and won't work properly on browsers that don't support this feature.

## Accessibility

Expand Down
40 changes: 0 additions & 40 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,5 @@
'use strict';

const funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
const BroccoliPostCSS = require('broccoli-postcss');
const postcssPresetEnv = require('postcss-preset-env');

const pkg = require('./package.json');

module.exports = {
name: require('./package').name,

treeForAddon() {
const tree = this._super(...arguments);
const app = this._findHost();
const options = typeof app.options === 'object' ? app.options : {};
const addonConfig = options[pkg.name] || {};

const addonWithoutStyles = funnel(tree, {
exclude: ['**/*.css'],
});

if (addonConfig.excludeCSS === true) {
return addonWithoutStyles;
}

const addonStyles = funnel(tree, {
include: ['**/*.css'],
});

const processedStyles = new BroccoliPostCSS(addonStyles, {
plugins: [
{
module: postcssPresetEnv,
options: {
stage: 3,
overrideBrowserslist: app.project._targets.browsers,
},
},
],
});

return mergeTrees([addonWithoutStyles, processedStyles]);
},
};
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,16 @@
"dependencies": {
"@ember/test-waiters": "^3.0.2",
"@embroider/util": "^1.7.1",
"broccoli-funnel": "^3.0.8",
"broccoli-merge-trees": "^4.2.0",
"broccoli-postcss": "^6.0.1",
"ember-auto-import": "^2.4.2",
"ember-cli-babel": "^7.26.11",
"ember-cli-htmlbars": "^6.0.1",
"focus-trap": "^6.9.3",
"postcss-preset-env": "^7.6.0"
"focus-trap": "^6.9.3"
},
"devDependencies": {
"@babel/eslint-parser": "7.23.10",
"@ember/optional-features": "2.0.0",
"@ember/string": "3.1.1",
"@ember/test-helpers": "2.9.4",
"@ember/test-helpers": "3.2.1",
"@embroider/macros": "1.13.4",
"@embroider/test-setup": "3.0.3",
"@release-it-plugins/lerna-changelog": "5.0.0",
Expand Down
Loading

0 comments on commit 6270e91

Please sign in to comment.