Skip to content

Commit 7f91b0c

Browse files
committed
Introduce ember-local-class package
1 parent 2b8753f commit 7f91b0c

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from 'glimmer-local-class-transform/-runtime';
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const { localClassRegistryPlugin } = require('glimmer-local-class-transform');
2+
3+
module.exports = {
4+
name: 'ember-local-class',
5+
setupPreprocessorRegistry(type, registry) {
6+
if (type === 'parent') {
7+
let options = (this.app ?? this.parent).options?.['ember-local-class'] ?? {};
8+
let runtimeModule = 'ember-local-class/-runtime';
9+
let extension = options.extension ?? '.module.css';
10+
let pathMapping = options.pathMapping ?? {
11+
'/template\\.hbs$': `/styles${extension}`,
12+
'/templates/(.*/)?(.*)\\.hbs$': `/styles/$1$2${extension}`,
13+
'(\\.g?[tj]s|\\.hbs)+$': extension,
14+
};
15+
16+
registry.add(
17+
'htmlbars-ast-plugin',
18+
localClassRegistryPlugin({ runtimeModule, pathMapping })
19+
);
20+
}
21+
}
22+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "ember-local-class",
3+
"version": "1.0.0-alpha.0",
4+
"description": "An Ember addon to automatically configure `glimmer-local-class-transform`",
5+
"keywords": [
6+
"ember-addon"
7+
],
8+
"homepage": "https://github.com/salsify/ember-css-modules/tree/master/packages/ember-local-class",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+ssh://[email protected]/salsify/ember-css-modules.git",
12+
"directory": "packages/ember-local-class"
13+
},
14+
"license": "MIT",
15+
"author": "Dan Freeman",
16+
"dependencies": {
17+
"ember-auto-import": "^2.10.0",
18+
"ember-cli-babel": "^8.2.0",
19+
"glimmer-local-class-transform": "^1.0.0-alpha.0"
20+
},
21+
"peerDependencies": {
22+
"@babel/core": "^7.0.0"
23+
},
24+
"ember-addon": {
25+
"before": [
26+
"ember-cli-htmlbars"
27+
]
28+
},
29+
"volta": {
30+
"extends": "../../package.json"
31+
}
32+
}

0 commit comments

Comments
 (0)