├── .bowerrc
├── .editorconfig
├── .ember-cli
├── .eslintignore
├── .eslintrc.js
├── .github
└── workflows
│ └── ci.yml
├── .gitignore
├── .npmignore
├── .template-lintrc.js
├── .watchmanconfig
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── addon
├── initializers
│ ├── component-styles.js
│ └── route-styles.js
├── instance-initializers
│ └── route-styles.js
├── mixins
│ └── style-namespacing-extras.js
├── pod-names.js
└── utils
│ └── init-route-styles.js
├── app
├── initializers
│ ├── component-styles.js
│ └── route-styles.js
├── instance-initializers
│ └── route-styles.js
└── mixins
│ └── style-namespacing-extras.js
├── bin
└── install-test-addons.js
├── config
├── ember-try.js
└── environment.js
├── ember-cli-build.js
├── index.js
├── lib
├── component-names.js
├── pod-names.js
├── pod-style.js
└── preprocess-class-names.js
├── package.json
├── testem.js
├── tests
├── .eslintrc.js
├── acceptance
│ ├── aborted-state-test.js
│ ├── addon-less-test.js
│ ├── addon-scss-test.js
│ ├── classic-structure-test.js
│ ├── css-test.js
│ ├── error-state-test.js
│ ├── less-test.js
│ ├── loading-state-test.js
│ ├── no-style-files-yet-test.js
│ ├── query-params-test.js
│ ├── sass-test.js
│ ├── scss-test.js
│ ├── styl-test.js
│ ├── template-style-only-test.js
│ └── unique-component-paths-test.js
├── dummy
│ ├── app
│ │ ├── aborted-state
│ │ │ ├── route.js
│ │ │ └── template.hbs
│ │ ├── addon
│ │ │ ├── less
│ │ │ │ └── template.hbs
│ │ │ └── scss
│ │ │ │ └── template.hbs
│ │ ├── app.js
│ │ ├── components
│ │ │ ├── base-rules
│ │ │ │ ├── component.js
│ │ │ │ └── template.hbs
│ │ │ ├── css
│ │ │ │ └── base-rules
│ │ │ │ │ ├── component.js
│ │ │ │ │ └── styles.css
│ │ │ ├── less
│ │ │ │ └── base-rules
│ │ │ │ │ ├── component.js
│ │ │ │ │ └── styles.less
│ │ │ ├── sass
│ │ │ │ └── base-rules
│ │ │ │ │ ├── component.js
│ │ │ │ │ └── styles.sass
│ │ │ ├── scss
│ │ │ │ ├── base-rules
│ │ │ │ │ ├── component.js
│ │ │ │ │ └── styles.scss
│ │ │ │ └── for-loop
│ │ │ │ │ ├── component.js
│ │ │ │ │ ├── styles.scss
│ │ │ │ │ └── template.hbs
│ │ │ ├── styl
│ │ │ │ └── base-rules
│ │ │ │ │ ├── component.js
│ │ │ │ │ └── styles.styl
│ │ │ └── template-and-style
│ │ │ │ ├── styles.scss
│ │ │ │ └── template.hbs
│ │ ├── css
│ │ │ ├── nested
│ │ │ │ └── styles.css
│ │ │ ├── styles.css
│ │ │ └── template.hbs
│ │ ├── error-state
│ │ │ ├── handled
│ │ │ │ └── route.js
│ │ │ ├── styles.scss
│ │ │ └── template.hbs
│ │ ├── index.html
│ │ ├── less
│ │ │ ├── nested
│ │ │ │ └── styles.less
│ │ │ ├── styles.less
│ │ │ └── template.hbs
│ │ ├── loading-state
│ │ │ ├── base
│ │ │ │ ├── styles.scss
│ │ │ │ └── template.hbs
│ │ │ ├── waiting-loading
│ │ │ │ ├── styles.scss
│ │ │ │ └── template.hbs
│ │ │ └── waiting
│ │ │ │ ├── route.js
│ │ │ │ ├── styles.scss
│ │ │ │ └── template.hbs
│ │ ├── no-style-files-yet
│ │ │ └── template.hbs
│ │ ├── query-params
│ │ │ ├── controller.js
│ │ │ ├── route.js
│ │ │ ├── styles.scss
│ │ │ └── template.hbs
│ │ ├── resolver.js
│ │ ├── router.js
│ │ ├── sass
│ │ │ ├── nested
│ │ │ │ └── styles.sass
│ │ │ ├── styles.sass
│ │ │ └── template.hbs
│ │ ├── scss
│ │ │ ├── nested
│ │ │ │ └── styles.scss
│ │ │ ├── styles.scss
│ │ │ └── template.hbs
│ │ ├── styl
│ │ │ ├── nested
│ │ │ │ └── styles.styl
│ │ │ ├── styles.styl
│ │ │ └── template.hbs
│ │ ├── styles
│ │ │ ├── app.css
│ │ │ ├── app.less
│ │ │ ├── app.sass
│ │ │ ├── app.scss
│ │ │ ├── app.styl
│ │ │ └── component-styles
│ │ │ │ ├── classic-structure.scss
│ │ │ │ └── nested
│ │ │ │ └── classic-structure-nested.scss
│ │ ├── template-style-only
│ │ │ └── template.hbs
│ │ ├── templates
│ │ │ ├── application.hbs
│ │ │ ├── classic-structure-nested.hbs
│ │ │ ├── classic-structure.hbs
│ │ │ └── components
│ │ │ │ ├── classic-structure.hbs
│ │ │ │ └── nested
│ │ │ │ └── classic-structure-nested.hbs
│ │ └── unique-component-paths
│ │ │ ├── -components
│ │ │ └── test-component
│ │ │ │ ├── styles.scss
│ │ │ │ └── template.hbs
│ │ │ └── template.hbs
│ ├── config
│ │ ├── environment.js
│ │ ├── optional-features.json
│ │ └── targets.js
│ ├── lib
│ │ ├── no-style-files-yet
│ │ │ ├── addon
│ │ │ │ └── components
│ │ │ │ │ └── no-style
│ │ │ │ │ ├── component.js
│ │ │ │ │ └── template.hbs
│ │ │ ├── app
│ │ │ │ └── components
│ │ │ │ │ └── no-style
│ │ │ │ │ └── component.js
│ │ │ ├── index.js
│ │ │ └── package.json
│ │ ├── second-test-addon
│ │ │ ├── addon
│ │ │ │ ├── components
│ │ │ │ │ └── second-addon-less
│ │ │ │ │ │ ├── component.js
│ │ │ │ │ │ ├── styles.less
│ │ │ │ │ │ └── template.hbs
│ │ │ │ └── styles
│ │ │ │ │ └── addon.less
│ │ │ ├── app
│ │ │ │ └── components
│ │ │ │ │ └── second-addon-less
│ │ │ │ │ └── component.js
│ │ │ ├── index.js
│ │ │ └── package.json
│ │ └── test-addon
│ │ │ ├── addon
│ │ │ ├── components
│ │ │ │ └── addon-scss
│ │ │ │ │ ├── component.js
│ │ │ │ │ ├── styles.scss
│ │ │ │ │ └── template.hbs
│ │ │ └── styles
│ │ │ │ └── addon.scss
│ │ │ ├── app
│ │ │ └── components
│ │ │ │ └── addon-scss
│ │ │ │ └── component.js
│ │ │ ├── index.js
│ │ │ └── package.json
│ └── public
│ │ ├── crossdomain.xml
│ │ └── robots.txt
├── helpers
│ ├── destroy-app.js
│ ├── module-for-acceptance.js
│ ├── resolver.js
│ └── start-app.js
├── index.html
└── test-helper.js
└── yarn.lock
/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "bower_components",
3 | "analytics": false
4 | }
5 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 |
8 | [*]
9 | end_of_line = lf
10 | charset = utf-8
11 | trim_trailing_whitespace = true
12 | insert_final_newline = true
13 | indent_style = space
14 | indent_size = 2
15 |
16 | [*.hbs]
17 | insert_final_newline = false
18 |
19 | [*.{diff,md}]
20 | trim_trailing_whitespace = false
21 |
--------------------------------------------------------------------------------
/.ember-cli:
--------------------------------------------------------------------------------
1 | {
2 | "usePods": true,
3 | /**
4 | Ember CLI sends analytics information by default. The data is completely
5 | anonymous, but there are times when you might want to disable this behavior.
6 |
7 | Setting `disableAnalytics` to true will prevent any data from being sent.
8 | */
9 | "disableAnalytics": false
10 | }
11 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | # unconventional js
2 | /blueprints/*/files/
3 | /vendor/
4 |
5 | # compiled output
6 | /dist/
7 | /tmp/
8 |
9 | # dependencies
10 | /bower_components/
11 | /node_modules/
12 |
13 | # misc
14 | /coverage/
15 | !.*
16 |
17 | # ember-try
18 | /.node_modules.ember-try/
19 | /bower.json.ember-try
20 | /package.json.ember-try
21 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parserOptions: {
4 | ecmaVersion: 2017,
5 | sourceType: 'module'
6 | },
7 | plugins: [
8 | 'ember'
9 | ],
10 | extends: [
11 | 'eslint:recommended',
12 | 'plugin:ember/recommended'
13 | ],
14 | env: {
15 | browser: true
16 | },
17 | rules: {
18 | },
19 | overrides: [
20 | // node files
21 | {
22 | files: [
23 | '.eslintrc.js',
24 | '.template-lintrc.js',
25 | 'ember-cli-build.js',
26 | 'index.js',
27 | 'testem.js',
28 | 'blueprints/*/index.js',
29 | 'config/**/*.js',
30 | 'tests/dummy/config/**/*.js'
31 | ],
32 | excludedFiles: [
33 | 'addon/**',
34 | 'addon-test-support/**',
35 | 'app/**',
36 | 'tests/dummy/app/**'
37 | ],
38 | parserOptions: {
39 | sourceType: 'script',
40 | ecmaVersion: 2015
41 | },
42 | env: {
43 | browser: false,
44 | node: true
45 | },
46 | plugins: ['node'],
47 | rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
48 | // add your custom rules and overrides for node files here
49 | })
50 | }
51 | ]
52 | };
53 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | - master
8 | tags:
9 | - v*
10 | pull_request: {}
11 |
12 | concurrency:
13 | group: ci-${{ github.head_ref || github.ref }}
14 | cancel-in-progress: true
15 |
16 | jobs:
17 | test:
18 | name: "Tests"
19 | runs-on: ubuntu-latest
20 |
21 | steps:
22 | - uses: actions/checkout@v2
23 | - name: Install Node
24 | uses: actions/setup-node@v2
25 | with:
26 | node-version: 12.x
27 | cache: yarn
28 | - name: Install Dependencies
29 | run: yarn install --frozen-lockfile
30 | - name: Lint
31 | run: yarn lint:js && yarn lint:hbs
32 | - name: Run Tests
33 | run: yarn test
34 |
35 | # floating:
36 | # name: "Floating Dependencies"
37 | # runs-on: ubuntu-latest
38 |
39 | # steps:
40 | # - uses: actions/checkout@v2
41 | # - uses: actions/setup-node@v2
42 | # with:
43 | # node-version: 12.x
44 | # cache: yarn
45 | # - name: Install Dependencies
46 | # run: yarn install --no-lockfile
47 | # - name: Run Tests
48 | # run: yarn test
49 |
50 | try-scenarios:
51 | name: ${{ matrix.try-scenario }}
52 | runs-on: ubuntu-latest
53 | needs: 'test'
54 |
55 | strategy:
56 | fail-fast: false
57 | matrix:
58 | try-scenario:
59 | - ember-lts-2.16
60 | - ember-lts-2.18
61 | # - ember-lts-3.24
62 | # - ember-lts-3.28
63 | # - ember-release
64 | # - ember-beta
65 | # - ember-canary
66 | # - ember-classic
67 | # - embroider-safe
68 | # - embroider-optimized
69 |
70 | steps:
71 | - uses: actions/checkout@v2
72 | - name: Install Node
73 | uses: actions/setup-node@v2
74 | with:
75 | node-version: 12.x
76 | cache: yarn
77 | - name: Install Dependencies
78 | run: yarn install --frozen-lockfile
79 | - name: Run Tests
80 | run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
81 |
82 | publish:
83 | name: Publish
84 | if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
85 | runs-on: ubuntu-latest
86 | needs: 'test'
87 |
88 | steps:
89 | - name: Checkout
90 | uses: actions/checkout@v2
91 | - name: Install Node
92 | uses: actions/setup-node@v2
93 | with:
94 | node-version: 12.x
95 | cache: yarn
96 | # This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
97 | registry-url: 'https://registry.npmjs.org'
98 |
99 | - name: Install Dependencies
100 | run: yarn install --frozen-lockfile
101 |
102 | - name: Publish to npm
103 | run: npm publish
104 | env:
105 | NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
106 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist/
5 | /tmp/
6 |
7 | # dependencies
8 | /bower_components/
9 | /node_modules/
10 |
11 | # misc
12 | /.sass-cache
13 | /connect.lock
14 | /coverage/
15 | /libpeerconnection.log
16 | /npm-debug.log*
17 | /testem.log
18 | /yarn-error.log
19 |
20 | # ember-try
21 | /.node_modules.ember-try/
22 | /bower.json.ember-try
23 | /package.json.ember-try
24 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | # compiled output
2 | /dist/
3 | /tmp/
4 |
5 | # dependencies
6 | /bower_components/
7 |
8 | # misc
9 | /.bowerrc
10 | /.editorconfig
11 | /.ember-cli
12 | /.eslintignore
13 | /.eslintrc.js
14 | /.github
15 | /.gitignore
16 | /.template-lintrc.js
17 | /.travis.yml
18 | /.watchmanconfig
19 | /bower.json
20 | /config/ember-try.js
21 | /CONTRIBUTING.md
22 | /ember-cli-build.js
23 | /testem.js
24 | /tests/
25 | /yarn.lock
26 | .gitkeep
27 |
28 | # ember-try
29 | /.node_modules.ember-try/
30 | /bower.json.ember-try
31 | /package.json.ember-try
32 |
--------------------------------------------------------------------------------
/.template-lintrc.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | extends: 'recommended'
5 | };
6 |
--------------------------------------------------------------------------------
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {
2 | "ignore_dirs": ["tmp", "dist"]
3 | }
4 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 |
6 | ## [0.8.1](https://github.com/ebryn/ember-component-css/compare/v0.8.0...v0.8.1) (2022-05-09)
7 |
8 |
9 |
10 |
11 | # [0.8.0](https://github.com/ebryn/ember-component-css/compare/v0.7.5...v0.8.0) (2022-05-09)
12 |
13 |
14 |
15 |
16 | ## [0.7.5](https://github.com/ebryn/ember-component-css/compare/v0.7.4...v0.7.5) (2022-05-09)
17 |
18 |
19 |
20 |
21 | ## [0.7.4](https://github.com/ebryn/ember-component-css/compare/v0.7.3...v0.7.4) (2019-06-24)
22 |
23 |
24 | ### Bug Fixes
25 |
26 | * **route-styles:** making sure that the route info object has the right shape before continuing fixs [#323](https://github.com/ebryn/ember-component-css/issues/323) ([6a90a5b](https://github.com/ebryn/ember-component-css/commit/6a90a5b))
27 |
28 |
29 |
30 |
31 | ## [0.7.3](https://github.com/ebryn/ember-component-css/compare/v0.7.2...v0.7.3) (2019-06-22)
32 |
33 |
34 | ### Bug Fixes
35 |
36 | * **route styles:** sometimes there is no 'to' in a route, and so we need to gaurd against that. fixes [#323](https://github.com/ebryn/ember-component-css/issues/323) ([157388d](https://github.com/ebryn/ember-component-css/commit/157388d))
37 |
38 |
39 |
40 |
41 | ## [0.7.2](https://github.com/ebryn/ember-component-css/compare/v0.7.1...v0.7.2) (2019-06-11)
42 |
43 |
44 | ### Bug Fixes
45 |
46 | * **broken transition:** there's a chance that at times a transition will not have a 'to', so handling that case ([756e89e](https://github.com/ebryn/ember-component-css/commit/756e89e))
47 |
48 |
49 |
50 |
51 | ## [0.7.1](https://github.com/ebryn/ember-component-css/compare/v0.7.0...v0.7.1) (2019-06-10)
52 |
53 |
54 |
55 |
56 | # [0.7.0](https://github.com/ebryn/ember-component-css/compare/v0.6.9...v0.7.0) (2019-06-03)
57 |
58 |
59 | ### Bug Fixes
60 |
61 | * **loading-route-styleNamespaces:** we needed to hack around and add in some extra hooks to take care of loading routes ([04db211](https://github.com/ebryn/ember-component-css/commit/04db211))
62 |
63 |
64 |
65 |
66 | ## [0.6.9](https://github.com/ebryn/ember-component-css/compare/v0.6.8...v0.6.9) (2019-05-23)
67 |
68 |
69 |
70 |
71 | ## [0.6.8](https://github.com/ebryn/ember-component-css/compare/v0.6.7...v0.6.8) (2019-05-23)
72 |
73 |
74 | ### Bug Fixes
75 |
76 | * **addon support:** setting the '_allPodStyles' on the host application to hopefully avoid issues with multiple copys ([7e00c02](https://github.com/ebryn/ember-component-css/commit/7e00c02))
77 |
78 |
79 |
80 |
81 | ## [0.6.7](https://github.com/ebryn/ember-component-css/compare/v0.6.5...v0.6.7) (2019-01-19)
82 |
83 |
84 | ### Bug Fixes
85 |
86 | * **deprication:** updated to fix the outdated merge and use object.assign instead ([8b46279](https://github.com/ebryn/ember-component-css/commit/8b46279))
87 | * **sass support:** latest sass now throws an eerro if semi colons are presnet, removing them from the style manifest. fixes issue [#301](https://github.com/ebryn/ember-component-css/issues/301) ([697e48c](https://github.com/ebryn/ember-component-css/commit/697e48c))
88 |
89 |
90 |
91 |
92 | ## [0.6.5](https://github.com/ebryn/ember-component-css/compare/v0.6.4...v0.6.5) (2018-09-10)
93 |
94 |
95 |
96 |
97 | ## [0.6.4](https://github.com/ebryn/ember-component-css/compare/v0.6.3...v0.6.4) (2018-06-20)
98 |
99 |
100 |
101 |
102 | ## [0.6.3](https://github.com/ebryn/ember-component-css/compare/v0.6.2...v0.6.3) (2018-02-26)
103 |
104 |
105 | ### Bug Fixes
106 |
107 | * **ember inspector:** Mixins created with an empty create breaks ember-inspector fixes [#275](https://github.com/ebryn/ember-component-css/issues/275) ([5533674](https://github.com/ebryn/ember-component-css/commit/5533674))
108 |
109 |
110 |
111 |
112 | ## [0.6.2](https://github.com/ebryn/ember-component-css/compare/v0.6.1...v0.6.2) (2018-02-06)
113 |
114 |
115 | ### Bug Fixes
116 |
117 | * **module imports:** moved functionality that belonged to just the addon, over to the addon. fix [#259](https://github.com/ebryn/ember-component-css/issues/259) ([c016731](https://github.com/ebryn/ember-component-css/commit/c016731))
118 |
119 |
120 |
121 |
122 | ## [0.6.1](https://github.com/ebryn/ember-component-css/compare/v0.6.0...v0.6.1) (2018-01-30)
123 |
124 |
125 | ### Bug Fixes
126 |
127 | * **router:** accidentally removed a import super call in the routers didTransition. fixes [#266](https://github.com/ebryn/ember-component-css/issues/266) ([446a368](https://github.com/ebryn/ember-component-css/commit/446a368))
128 |
129 |
130 |
131 |
132 | # [0.6.0](https://github.com/ebryn/ember-component-css/compare/v0.5.0...v0.6.0) (2018-01-26)
133 |
134 |
135 |
136 |
137 | # [0.5.0](https://github.com/ebryn/ember-component-css/compare/v0.4.0...v0.5.0) (2017-11-17)
138 |
139 |
140 | ### Features
141 |
142 | * **styleNamespace:** now upgrading to using 'styleNamespace' for the namespace computed property. Will offically deprecate componentCssClassName in the future ([#254](https://github.com/ebryn/ember-component-css/issues/254)) ([4bb72f9](https://github.com/ebryn/ember-component-css/commit/4bb72f9))
143 |
144 |
145 |
146 |
147 | # [0.4.0](https://github.com/ebryn/ember-component-css/compare/v0.3.7...v0.4.0) (2017-11-15)
148 |
149 |
150 | ### Features
151 |
152 | * **route-namesapce:** Enable name-spacing of route styles ([114fe3b](https://github.com/ebryn/ember-component-css/commit/114fe3b))
153 | * **route-namespace:** added documentation about an individual controllers styleNamespace property ([cb94979](https://github.com/ebryn/ember-component-css/commit/cb94979))
154 |
155 |
156 |
157 |
158 | ## [0.3.7](https://github.com/ebryn/ember-component-css/compare/v0.3.6...v0.3.7) (2017-11-02)
159 |
160 |
161 | ### Features
162 |
163 | * **manifest ordering:** updated broccoli style manifest to now have the order of files in the manifest be sorted first by depth, then by alphanumeric ([fd710bf](https://github.com/ebryn/ember-component-css/commit/fd710bf))
164 |
165 |
166 |
167 |
168 | ## [0.3.6](https://github.com/ebryn/ember-component-css/compare/v0.3.5...v0.3.6) (2017-11-01)
169 |
170 |
171 |
172 |
173 | ## [0.3.5](https://github.com/ebryn/ember-component-css/compare/v0.3.4...v0.3.5) (2017-07-31)
174 |
175 |
176 | ### Bug Fixes
177 |
178 | * **component name parsing:** only switching out the word 'component/' if it is what starts the path, not for nest options. This should be revisited with unification Closes [#236](https://github.com/ebryn/ember-component-css/issues/236) ([54e087e](https://github.com/ebryn/ember-component-css/commit/54e087e))
179 |
180 |
181 |
182 |
183 | ## [0.3.4](https://github.com/ebryn/ember-component-css/compare/v0.3.3...v0.3.4) (2017-06-01)
184 |
185 |
186 | ### Bug Fixes
187 |
188 | * **ensure environment:** getting the 'root host', and using a shim if the find host method isn't present, Closes [#231](https://github.com/ebryn/ember-component-css/issues/231) ([09fa5ec](https://github.com/ebryn/ember-component-css/commit/09fa5ec))
189 |
190 |
191 |
192 |
193 | ## [0.3.3](https://github.com/ebryn/ember-component-css/compare/v0.3.2...v0.3.3) (2017-04-24)
194 |
195 |
196 |
197 |
198 | ## [0.3.2](https://github.com/ebryn/ember-component-css/compare/v0.3.1...v0.3.2) (2017-04-05)
199 |
200 |
201 | ### Bug Fixes
202 |
203 | * **style manifest:** updated to new brocoli-style-mainifest properties that are more explicit ([5e848ca](https://github.com/ebryn/ember-component-css/commit/5e848ca))
204 |
205 |
206 | ### Features
207 |
208 | * **optimization:** ability to use terse class names to reduce css size ([d53ead8](https://github.com/ebryn/ember-component-css/commit/d53ead8))
209 |
210 |
211 |
212 |
213 | ## [0.3.1](https://github.com/ebryn/ember-component-css/compare/v0.3.0...v0.3.1) (2017-03-30)
214 |
215 |
216 | ### Bug Fixes
217 |
218 | * **npm dependencies:** published what was being used to compile multiple differnt css preprocessors into one. closes [#221](https://github.com/ebryn/ember-component-css/issues/221) ([a060942](https://github.com/ebryn/ember-component-css/commit/a060942))
219 |
220 |
221 |
222 |
223 | # [0.3.0](https://github.com/ebryn/ember-component-css/compare/v0.2.12...v0.3.0) (2017-02-25)
224 |
225 |
226 | ### Features
227 |
228 | * **extensible identifier:** moved the generation of the namespace identifier and if the class should be added to a mixin for easier extensibility ([e3c627b](https://github.com/ebryn/ember-component-css/commit/e3c627b))
229 |
230 |
231 |
232 |
233 | ## [0.2.12](https://github.com/ebryn/ember-component-css/compare/v0.2.11...v0.2.12) (2017-02-24)
234 |
235 |
236 | ### Bug Fixes
237 |
238 | * **description:** removed pod specificity ([16eae3b](https://github.com/ebryn/ember-component-css/commit/16eae3b))
239 | * **scss @ rules:** now allowing namespaceing of rules deinfed inside of a scss @ for rule. Fixes [#216](https://github.com/ebryn/ember-component-css/issues/216) ([6840c5e](https://github.com/ebryn/ember-component-css/commit/6840c5e))
240 |
241 |
242 |
243 |
244 | ## [0.2.11](https://github.com/ebryn/ember-component-css/compare/v0.2.10...v0.2.11) (2017-02-03)
245 |
246 |
247 | ### Bug Fixes
248 |
249 | * **documentation:** updated for readabitlity ([d354534](https://github.com/ebryn/ember-component-css/commit/d354534))
250 |
251 |
252 |
253 |
254 | ## [0.2.10](https://github.com/ebryn/ember-component-css/compare/v0.2.9...v0.2.10) (2017-01-26)
255 |
256 |
257 | ### Bug Fixes
258 |
259 | * **plain css:** Due to the odd nature of 'glob', you can't have a set of just one item. ([fd0d770](https://github.com/ebryn/ember-component-css/commit/fd0d770)), closes [#178](https://github.com/ebryn/ember-component-css/issues/178) [#204](https://github.com/ebryn/ember-component-css/issues/204)
260 |
261 |
262 |
263 |
264 | ## [0.2.9](https://github.com/ebryn/ember-component-css/compare/v0.2.8...v0.2.9) (2017-01-16)
265 |
266 |
267 | ### Bug Fixes
268 |
269 | * **nested addons:** no longer switching to the parent app so that addon's specific settings can be used ([849a72d](https://github.com/ebryn/ember-component-css/commit/849a72d))
270 |
271 |
272 |
273 |
274 | ## [0.2.8](https://github.com/ebryn/ember-component-css/compare/v0.2.7...v0.2.8) (2016-12-14)
275 |
276 |
277 |
278 |
279 | ## [0.2.7](https://github.com/ebryn/ember-component-css/compare/v0.2.6...v0.2.7) (2016-12-01)
280 |
281 |
282 | ### Bug Fixes
283 |
284 | * **namespacing:** no longer namespacing children of @ rules ([489f23f](https://github.com/ebryn/ember-component-css/commit/489f23f)), closes [#191](https://github.com/ebryn/ember-component-css/issues/191)
285 |
286 |
287 |
288 |
289 | ## [0.2.6](https://github.com/ebryn/ember-component-css/compare/v0.2.5...v0.2.6) (2016-12-01)
290 |
291 |
292 | ### Bug Fixes
293 |
294 | * **ember-2.11:** moving to concatenating and reassigning the classnames in case a classname is already in the array before the init call per [@rwjblue](https://github.com/rwjblue) suggestion ([40113e6](https://github.com/ebryn/ember-component-css/commit/40113e6))
295 |
296 |
297 |
298 |
299 | ## [0.2.5](https://github.com/ebryn/ember-component-css/compare/v0.2.4...v0.2.5) (2016-12-01)
300 |
301 |
302 | ### Bug Fixes
303 |
304 | * **ember-2.11:** now not pushing to the frozen classnames property, but reasigning it ([63274c0](https://github.com/ebryn/ember-component-css/commit/63274c0))
305 |
306 |
307 |
308 |
309 | ## [0.2.4](https://github.com/ebryn/ember-component-css/compare/v0.2.3...v0.2.4) (2016-11-22)
310 |
311 |
312 |
313 |
314 | ## [0.2.3](https://github.com/ebryn/ember-component-css/compare/v0.2.2...v0.2.3) (2016-11-15)
315 |
316 |
317 |
318 |
319 | ## [0.2.2](https://github.com/ebryn/ember-component-css/compare/v0.2.1...v0.2.2) (2016-11-05)
320 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How To Contribute
2 |
3 | ## Installation
4 |
5 | * `git clone `
6 | * `cd my-addon`
7 | * `npm install`
8 |
9 | ## Linting
10 |
11 | * `npm run lint:hbs`
12 | * `npm run lint:js`
13 | * `npm run lint:js -- --fix`
14 |
15 | ## Running tests
16 |
17 | * `ember test` – Runs the test suite on the current Ember version
18 | * `ember test --server` – Runs the test suite in "watch mode"
19 | * `ember try:each` – Runs the test suite against multiple Ember versions
20 |
21 | ## Running the dummy application
22 |
23 | * `ember serve`
24 | * Visit the dummy application at [http://localhost:4200](http://localhost:4200).
25 |
26 | For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017
4 |
5 | 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:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | 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.
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ember-component-css [](https://github.com/ebryn/ember-component-css/actions/workflows/ci.yml) [](https://emberobserver.com/addons/ember-component-css)
2 |
3 | An Ember CLI addon which allows you to specify component-specific style sheets in an app, addon, engine, or in-repo addon.
4 |
5 | Contributions are welcome! Feel free to open up a pull request or issue, and join the **#e-component-css** channel on the [official Ember Discord server](https://discord.gg/zT3asNS) if you have further questions, concerns, or ideas. Thanks! :smile:
6 |
7 | ## Installation
8 |
9 | `ember install ember-component-css`
10 |
11 | ## Usage
12 |
13 | Rules defined in the style-sheets will automatically be namespaced with an autogenerated class. That autogenerated class will also be injected into your component's `classNames` property. This enables you to worry less about rules clashing across component styles.
14 |
15 | For example, given this `app/my-component/styles.scss` file for 'pods',
16 |
17 | or this `app/styles/component-styles/my-component.scss` file for 'classic':
18 |
19 | ```scss
20 | & { // ampersand refers to the component itself (parent selector)
21 | padding: 2px;
22 | }
23 | .urgent {
24 | color: red;
25 |
26 | span {
27 | text-decoration: underline;
28 | }
29 | }
30 | ```
31 |
32 | Your generated CSS output will look something like:
33 |
34 | ```css
35 | .__my-component__a34fba {
36 | padding: 2px;
37 | }
38 | .__my-component__a34fba .urgent {
39 | color: red;
40 | }
41 | .__my-component__a34fba .urgent span {
42 | text-decoration: underline;
43 | }
44 | ```
45 |
46 | A typical component invocation that looks like this:
47 |
48 | `{{my-component}}`
49 |
50 | will generated markup like:
51 |
52 | ``
53 |
54 | ### Inclusion
55 |
56 | To use this addon you *MUST*, import `pod-styles` into your base stylesheet.
57 |
58 | ```scss
59 | // app/styles/app.scss
60 | @import "pod-styles";
61 | ```
62 |
63 | ```scss
64 | // app/styles/app.less
65 | @import "pod-styles";
66 | ```
67 |
68 | ```scss
69 | // app/styles/app.styl
70 | @import 'pod-styles'
71 | ```
72 |
73 | ```css
74 | /* app/styles/app.css */
75 | @import "pod-styles.css";
76 | ```
77 |
78 | And that is it! The `pod-styles` file is generated during the build and will then be pulled into your other stylesheet to be processed like normal.
79 |
80 | Note: If you are using more than one type of component style files (ie a .less file and a .scss file) then you will need to add the extension to the @import. Otherwise the extension can be left off.
81 |
82 | ### Usage with pods structure
83 |
84 | To use this with pods, you just need to include a style file in your component pods directory alongside your `template.hbs` or `component.js` files.
85 |
86 | ### Usage with routes
87 |
88 | To use this with routes you need to use pods for the routes and modify the `application.hbs` template a little bit.
89 | Let's assume your `application.hbs` template looks like this:
90 |
91 | ```hbs
92 | {{outlet}}
93 | ```
94 |
95 | To be able to use this for routes, you need to add a wrapping `div` around the outlet:
96 |
97 | ```hbs
98 |
99 | {{outlet}}
100 |
101 | ```
102 |
103 | After that it's quite easy: add a style file in your route directory alongside your `route.js` or `template.hbs` files.
104 |
105 | An individual controller also has access to a `styleNamespace` property that is the namespace for a given route. This can be used for various use cases. (like enabling BEM style similar to how the `styleNamespace` is used in a component)
106 |
107 | ### Usage with classic (non pod) structure
108 |
109 | You can use classic Ember app structure by placing component styles in
110 | `app/styles/component-styles`. Name your style files after the component name,
111 | for example `my-component.scss`. The directory where styles are fetched from can
112 | be configured as shown [below](#configuration). It's possible to use a mixture
113 | of classic and pod structured styles in the same app, if you use both styles for
114 | the same component both are included but the pod style will take precedence.
115 |
116 | ### Use in addons
117 | In order to use this inside of an addon, you need to add your style files inside of the components in the
118 | addon directory. You will then be able to import the 'pod-styles' file inside of your addon style file which
119 | is in the `/addon/styles` directory. These styles will then be added to the `vendor.css` file like normal.
120 |
121 | If you are using classic (non pod) structure, your addon directory structure might look like:
122 | ```
123 | yourAddonDirectory
124 | │ index.js
125 | │ ... etc
126 | └───addon
127 | │ └───components
128 | │ │ yourAddonComponent.js
129 | │ └───templates
130 | │ │ yourAddonComponent.hbs
131 | │ └───styles
132 | │ │ addon.scss (includes the 'pod-styles' import)
133 | │ └───component-styles (this dir name is configurable)
134 | │ │ yourAddonComponent.scss
135 | └───app
136 | └───components
137 | │ yourAddonComponent.js
138 | ```
139 |
140 | If you are extending the `include` method in your addon, please make sure you call the super like this
141 | ```js
142 | included: function(app) {
143 | this._super.included.apply(this, arguments);
144 | ...
145 | }
146 | ```
147 |
148 | Be sure "ember-component-css" is listed under the "dependencies" key of your addon's `package.json` file, rather than "devDependencies". Don't forget, if you are using `ember-cli-sass` for your addon's styles, it will need to be in "dependencies" as well.
149 |
150 | Finally, if your addon is compiling the expected CSS into the host's `vendor.css` output, but the expected classes are not being set on your components' HTML elements, you will need to [run your addon _after_ ember-component-css](https://ember-cli.com/extending/#configuring-your-ember-addon-properties):
151 | ```js
152 | // package.json
153 | {
154 | // ...
155 | "dependencies": {
156 | // ...
157 | "ember-component-css": ">= 0.6.4",
158 | // ...
159 | },
160 | // ...
161 | "ember-addon": {
162 | "configPath": "tests/dummy/config",
163 | "after": "ember-component-css"
164 | }
165 | }
166 | ```
167 |
168 | ### Plain css usage
169 | In order to use this with plain css files, you need to install [`ember-cli-postcss`](https://github.com/jeffjewiss/ember-cli-postcss) and configure it with [`postcss-import`](https://github.com/postcss/postcss-import).
170 |
171 | ```
172 | ember install ember-component-css
173 | ember install ember-cli-postcss
174 | npm install postcss-import --save-dev
175 | ```
176 | Then in your `ember-cli-build.js` you can configure it as such.
177 | ```js
178 | var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
179 | var CssImport = require('postcss-import');
180 |
181 | module.exports = function(defaults) {
182 | var app = new EmberAddon(defaults, {
183 | postcssOptions: {
184 | compile: {
185 | enabled: true,
186 | plugins: [{
187 | module: CssImport,
188 | }]
189 | }
190 | }
191 | });
192 |
193 | return app.toTree();
194 | };
195 | ```
196 |
197 | You can also add in [`postcss-cssnext`](https://github.com/MoOx/postcss-cssnext) or any other
198 | postcss plugins in this way too.
199 |
200 | *Things like [`ember-cli-autoprefixer`](https://github.com/kimroen/ember-cli-autoprefixer) will work out of the box and do not need to be added in as a postcss plugin.*
201 |
202 | ### Getting the generated class name
203 |
204 | You also have access to the generated class name to use in your templates. There is a computed property `styleNamespace` This can be used to pass the class name to things like [`ember-wormhole`](https://github.com/yapplabs/ember-wormhole) or for use in BEM style classnames.
205 | An example of BEM usage would be
206 |
207 | `my-component/template.hbs`
208 | ```handlebars
209 |
212 |
215 |
218 | ```
219 | `my-component/styles.scss`
220 | ```scss
221 | &__button {
222 | display: inline-block;
223 | border-radius: 3px;
224 | padding: 7px 12px;
225 | border: 1px solid #D5D5D5;
226 | background-image: linear-gradient(#EEE, #DDD);
227 | font: 700 13px/18px Helvetica, arial;
228 |
229 | &--state-success {
230 | color: #FFF;
231 | background: #569E3D linear-gradient(#79D858, #569E3D) repeat-x;
232 | border-color: #4A993E;
233 | }
234 |
235 | &--state-danger {
236 | color: #900;
237 | }
238 | }
239 | ```
240 |
241 | *`componentCssClassName` will be officially deprecated, then removed in future versions. Will be migrating to the more appropriately named `styleNamespace`*
242 |
243 | #### Using the generated class name in `classNameBindings`
244 |
245 | You can build your own computed properties on top of `styleNamespace`. One use case is using it to build a `classNameBinding`:
246 |
247 | `my-component/component.hbs`
248 | ```js
249 | classNameBindings: ['customBinding'],
250 | stateProperty: false,
251 | customBinding: computed('styleNamespace', 'stateProperty', function() {
252 | if (this.get('stateProperty')) {
253 | return `${this.get('styleNamespace')}--state`;
254 | } else {
255 | return '';
256 | }
257 | }),
258 | ```
259 | `my-component/styles.scss`
260 | ```scss
261 | & {
262 | background: blue;
263 | }
264 | &--state {
265 | background: red;
266 | }
267 | ```
268 |
269 | ### Special Tag-less components
270 |
271 | On the special cases of tag-less components (this functionality is used putting a `tagName: ''` value in the component), the styles are not attached to the DOM, as this addon needs a tag to attach the generated class name. In those special cases, you can use the `styleNamespace`* classname if you want to attach to a another element in the application (or more coherently inside the tag-less component).
272 |
273 | ### Configuration
274 |
275 | You can set the following configuration options in your `config/environment.js` file:
276 |
277 | ```js
278 | ENV['ember-component-css'] = {
279 | option: 'value'
280 | }
281 | ```
282 |
283 | **namespacing(_enabled_)**
284 |
285 | Defaults to true. Set this option to `false` to disable the namespacing feature of Ember Component CSS.
286 |
287 | ```js
288 | ENV['ember-component-css'] = {
289 | namespacing: false
290 | }
291 | ```
292 |
293 | This changes the default behavior in two ways:
294 |
295 | 1. The autogenerated component class is no longer added to your component's HTML
296 | 2. Your pod CSS files are no longer namespaced using the autogenerated component class.
297 |
298 | **classicStyleDir**
299 |
300 | Defaults to `component-styles`. Set this to the directory where your classically
301 | structured styles live (within `/app/styles`). For example:
302 |
303 | ```js
304 | ENV['ember-component-css'] = {
305 | classicStyleDir: 'my-styles'
306 | }
307 | ```
308 |
309 | **excludeFromManifest**
310 |
311 | Defaults to `[]`. Set this option to one or more matcher expression (regular expression, glob string, or function).
312 | Style files matching the expresion(s) will be namespaced but not imported in the `pod-styles` manifest. You will
313 | need to import the matching style files manually in your CSS. This can be useful when you need to control the order
314 | in which specific style files need to be imported.
315 |
316 | Example:
317 | You want to have a separate style file for each media-query breakpoint. You want to be sure that `_style-1366.scss`
318 | will be imported before `_style-960.scss`
319 |
320 | ```
321 | .
322 | └── my-component/
323 | ├── _style-1366.scss
324 | ├── _style-960.scss
325 | ├── main.scss
326 | ├── component.js
327 | └── template.hbs
328 | ```
329 |
330 | ```sass
331 | // main.scss
332 | @import "./_style-1366"
333 | @import "./_style-960"
334 | ```
335 |
336 | ```js
337 | ENV['ember-component-css'] = {
338 | excludeFromManifest: ['**/_style-*']
339 | }
340 | ```
341 |
342 | **patchClassicComponent**
343 |
344 | Set this option to `false` to prevent automatic `Component.reopen()` call which injects
345 | the autogenerated class into component's `classNames` property.
346 |
347 | You would need to use {{this.styleNamespace}} in *all* of your templates instead:
348 |
349 | ```hbs
350 |