You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MU] Funnel in Styles (no more app.trees.styles) #7862
I've been experimenting around with MU but might also be in combination with the new packager. So tried to port over some things from my classic app I want to use with MU. I wanted to continue using bootstrap scss in my app (without using ember-bootstrap addon). In my classic app I would do:
Now, that stopped working with MU, since there is no more app.trees.styles. Instead I had to funnel it into app.trees.src. Also app.tree.src = mergeTrees(...); didn't work either, because I got this error:
EslintValidationFilter can only handle one:* broccoli nodes, but part of the given input pipeline is a many:* node. (broccoli-merge-trees is an example of a many:* node) Please perform many:* operations after linting.
I ended up overwriting getSrc() and funnel in bootstrap scss, this is how it looks:
app.getSrc = function () {
let rawSrcTree = this.trees.src;
if (!rawSrcTree) {
return null;
}
const bootstrapTree = new Funnel('node_modules/bootstrap/scss', {
destDir: 'src/ui/styles/bootstrap',
annotation: 'Bootstrap'
});
const src = new Funnel(rawSrcTree, {
destDir: 'src',
});
return mergeTrees([src, bootstrapTree], {
overwrite: true
});
};
I don't like that solution for various reasons:
If something upstream getSrc() changes, I don't get it (though can get the original src tree from super.
It is unhandy and error prone.
I don't know what the new Packager will bring and if there is a solution to this already planned. Especially if there is a package hook already in place. I'm pretty sure, people will come here and claim their app.trees.styles stopped working and are looking for a solution to this.
I am only interessted in bootstrap scss files, so why should I install too much clutter? Bare bootstrap is fully enough
The question is how to funnel in styles. It isn't app.trees.styles anymore but app.trees.src. I tried your idea from above, though there is an error showing up: EslintValidationFilter can only handle one:* broccoli nodes, but part of the given input pipeline is a many:* node. (broccoli-merge-trees is an example of a many:* node) Please perform many:* operations after linting.
Here is the log
=================================================================================
ENV Summary:
TIME: Tue Jul 03 2018 19:52:14 GMT+0200 (Mitteleuropäische Sommerzeit)
TITLE: ember
ARGV:
- /usr/local/Cellar/node/10.5.0_1/bin/node
- /Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/.bin/ember
- serve
EXEC_PATH: /usr/local/Cellar/node/10.5.0_1/bin/node
TMPDIR: /var/folders/tv/67gb0k1s7yz4f0cgn8kvqbj00000gn/T
SHELL: /bin/bash
PATH:
- [...]
PLATFORM: darwin x64
FREEMEM: 308396032
TOTALMEM: 17179869184
UPTIME: 960849
LOADAVG: 4.609375,3.494140625,3.330078125
CPUS:
- Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz - 3500
- Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz - 3500
- Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz - 3500
- Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz - 3500
ENDIANNESS: LE
VERSIONS:
- ares: 1.14.0
- cldr: 33.1
- http_parser: 2.8.0
- icu: 62.1
- modules: 64
- napi: 3
- nghttp2: 1.32.0
- node: 10.5.0
- openssl: 1.1.0h
- tz: 2018e
- unicode: 11.0
- uv: 1.20.3
- v8: 6.7.288.46-node.8
- zlib: 1.2.11
ERROR Summary:
- broccoliBuilderErrorStack: [undefined]
- codeFrame: [undefined]
- errorMessage: EslintValidationFilter can only handle one:* broccoli nodes, but part of the given input pipeline is a many:* node. (broccoli-merge-trees is an example of a many:* node) Please perform many:* operations after linting.
- errorType: [undefined]
- location:
- column: [undefined]
- file: [undefined]
- line: [undefined]
- message: EslintValidationFilter can only handle one:* broccoli nodes, but part of the given input pipeline is a many:* node. (broccoli-merge-trees is an example of a many:* node) Please perform many:* operations after linting.
- name: Error
- nodeAnnotation: [undefined]
- nodeName: [undefined]
- originalErrorMessage: [undefined]
- stack: Error: EslintValidationFilter can only handle one:* broccoli nodes, but part of the given input pipeline is a many:* node. (broccoli-merge-trees is an example of a many:* node) Please perform many:* operations after linting.
at resolveInputDirectory (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/broccoli-lint-eslint/lib/index.js:32:11)
at new EslintValidationFilter (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/broccoli-lint-eslint/lib/index.js:83:19)
at Function.EslintValidationFilter.create (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/broccoli-lint-eslint/lib/index.js:226:16)
at Class.lintTree (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/ember-cli-eslint/index.js:44:19)
at addons.reduce (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/ember-cli/lib/utilities/lint-addons-by-type.js:6:23)
at Array.reduce (<anonymous>)
at lintAddonsByType (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/ember-cli/lib/utilities/lint-addons-by-type.js:4:17)
at EmberApp.addonLintTree (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/ember-cli/lib/broccoli/ember-app.js:889:18)
at EmberApp.getLintTests (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/ember-cli/lib/broccoli/ember-app.js:1389:28)
at EmberApp.getTests (/Users/thomas/Sites/packages/gossi/freestyle-tools/node_modules/ember-cli/lib/broccoli/ember-app.js:1303:28)
=================================================================================
Overriding app.getSrc() is the only working solution for me at the moment.
I may add: For MU I had the assumption that app.trees.styles will be merged into src/ when app.toTree() is run. That's what ember devs learned over the years and I for myself would consider that as the more cleaner API, since it is more explicit over what you do and as such less error prone.
@gossiapp.trees.styles was never a public api afaik, these are internal constructs; I can't remember that we ever advice anyone to merge styles (or other files) into app.trees.
that being said, I submitted a fix to restore the old behaviour but I can't say I recommend this pattern (although I fully understand why you do it.)
Aha, funny. I didn't know app.trees.styles was private until now and makes me understand you better. The idea I had in mind is to provide app/addon and engine? authors the chance to provide a single way of adding styles into their project. That said app.trees.styles doesn't have to be that kind of API. If I remember correctly that reading it somewhere, the ember-cli configuration - currently spread across ember-cli-build.js and index.js should be streamlined? I guess that's the proper place to think about that kind of API as well.
Activity
twokul commentedon Jul 3, 2018
@gossi sorry for taking so long to respond!
I've got couple of questions:
ember-bootstrapadd-on? totally fine not to use it, just curiousapp.trees.srccontains all the styles now and you should be able to dogossi commentedon Jul 3, 2018
app.trees.stylesanymore butapp.trees.src. I tried your idea from above, though there is an error showing up:EslintValidationFilter can only handle one:* broccoli nodes, but part of the given input pipeline is a many:* node. (broccoli-merge-trees is an example of a many:* node) Please perform many:* operations after linting.Here is the log
Overriding
app.getSrc()is the only working solution for me at the moment.gossi commentedon Jul 3, 2018
I may add: For MU I had the assumption that
app.trees.styleswill be merged intosrc/whenapp.toTree()is run. That's what ember devs learned over the years and I for myself would consider that as the more cleaner API, since it is more explicit over what you do and as such less error prone.twokul commentedon Jul 3, 2018
@gossi
app.trees.styleswas never a public api afaik, these are internal constructs; I can't remember that we ever advice anyone to merge styles (or other files) intoapp.trees.that being said, I submitted a fix to restore the old behaviour but I can't say I recommend this pattern (although I fully understand why you do it.)
gossi commentedon Jul 4, 2018
Aha, funny. I didn't know
app.trees.styleswas private until now and makes me understand you better. The idea I had in mind is to provide app/addon and engine? authors the chance to provide a single way of adding styles into their project. That saidapp.trees.stylesdoesn't have to be that kind of API. If I remember correctly that reading it somewhere, the ember-cli configuration - currently spread acrossember-cli-build.jsandindex.jsshould be streamlined? I guess that's the proper place to think about that kind of API as well.willviles commentedon Jul 26, 2018
@gossi - with regard to part 2 of your issue, there's a problem with Ember CLI ESLint and merging trees into MU's
app.trees.src.ember-cli/ember-cli-eslint#56 (comment)
locks commentedon Mar 28, 2020
MU is dead, long live MU!