webark / broccoli-file-manifest Goto Github PK
View Code? Open in Web Editor NEWBroccoli plugin that takes creates an import mainfest file of differnt files.
License: MIT License
Broccoli plugin that takes creates an import mainfest file of differnt files.
License: MIT License
Would be really helpful to see/understand what is going on here if there were some tests.
I would suggest using broccoli-test-helper, which would let you do something like (pseudo code):
it("should build", async function() {
input.write({
"src": {
"ui": {
"components": {
"todo-item": {
"style.scss": '/* todo item styles */'
},
"other-thing": {
"style.scss": '/* other thing styles */'
}
}
}
}
});
await output.build();
expect(output.read()).to.deep.equal({
"src": {
"ui": {
"styles": {
"app.scss": stripIndent`
@import "src/ui/components/todo-item/style";
@import "src/ui/components/other-thing/style";`
},
"components": {
"todo-item": {
"style.scss": '/* todo item styles */'
},
"other-thing": {
"style.scss": '/* other thing styles */'
}
}
}
}
});
});
I believe making this project an ember-cli addon would basically require the following steps:
package.json
:{
// snip ....
"keywords": [
// existing keywords?
"ember-addon"
],
"ember-addon": {
"main": "ember-addon-index.js"
}
}
ember-addon-index.js
file with the following contents:const MergeTrees = require('broccoli-merge-trees');
const StyleManifest = require('broccoli-style-manifest');
module.exports = {
name: 'broccoli-style-manifest',
preprocessTree(type, tree) {
if (type === 'src') {
return new MergeTrees([tree, new StyleManifest(tree, {
outputFileNameWithoutExtension: 'src/ui/styles/app'
})], { overwrite: true });
}
}
};
Doing the above would enable folks to opt-in to colocated styles in glimmer apps (and ultimately ember apps with module unification layout) via:
ember new my-app -b @glimmer/blueprint
cd my-app
ember install broccoli-style-manifest
This project is awesome you should show it off ๐ธ
Imagine a scenario where you have some shared styles, that you keep in src/ui/app.scss
, but still want to support adding @import "all/other/files"
.
I believe currently, this plugin will always clobber the output file if it is already present. IMHO, that is a bug, we should either just add to the file or throw a very loud error ๐ ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.