Open MalumAtire832 opened 4 years ago
It appears that the ignoreImports
option has been renamed to ignoredImports
(notice the d)
I included the following property and value in my scss-bundle.config.json and the outFile did not contain any material scss code:
"ignoredImports": ["~@angular/.*"],
@jefferywroblewski-accesso Might this be for a newer version? My version does not seem to know the ignoredImports
option when used in the CLI, it specificly says so.
As for the issue at hand, i seem to have fixed it.
I was running scss-bundle from the projects/myproject
directory, with the rootdir also set to this directory. This meant it could not find my node_modules 2 directories up. While messing around i got the hint 'found tilde import but no node_modules found.'
The solution for me was to move the scss-bundle.config.json
to the root of my workspace and change some values:
{
"bundlerOptions": {
"entryFile": "projects/shared-components/src/_theme.scss",
"outFile": "dist/shared-components/bundled.scss",
"rootDir": "",
"ignoreImports": ["~@angular/.*"],
"logLevel": "debug"
}
}
Everything is now working like it should now that scss-bundle
can find my node_modules.
Maybe someone else can verify this issue, because the error message is very misleading if this is the case. I'll leave this issue open for any possible feedback for the time beeing.
Same problem occurs here.
having a projects/my-project/scss-bundle.config.json
and running:
"build:theming:scss": "scss-bundle --project='./projects/my-project'",
does not work.
Moving the scss-bundle.config.json
to the root fixes it.
But I would love to have the config in de project root instead of the workspace root. (we have multiple projects)
--project: Project location where scss-bundle.config.json and node_modules are located.
Would be nice if this was separated: node_modules default from root or something? (or a separate option)
@MalumAtire832 , My mistake. The ignoredImports
was only available in previous versions (I was using 2.5.1
). I installed the latest version (which is 3.0.2
at the time of this post) and discovered the configuration scheme was refactored between the two versions. The old ignoredImports
property was removed and replaced with the bundlerOptions.ignoreImports
property.
I was able to get this working where it is only ignoring the @angular imports using the same approach that you used. Thanks for the comment which reminded me to look for an updated version. 👍
Hey @the-ult and @MalumAtire832. If I understood correctly, you having issues with configuration file location and where exactly node_modules
are.
I have published a new canary version. It has CLI flag --config
and project
property in bundlerOptions
.
$ npm install scss-bundle@0.0.0-canary.9f111cb -D
I think another issue is somewhat related #74.
Thanks @MartynasZilinskas will give it a try tomorrow
@MartynasZilinskas The combination of the --config
and project
options seems to work for me:
{
"bundlerOptions": {
"entryFile": "./projects/shared-components/src/_theme.scss",
"rootDir": "./projects/shared-components/src",
"project": "../../",
"outFile": "./dist/shared-components/theme.scss",
"ignoreImports": ["~@angular/.*"],
"logLevel": "debug"
}
}
Thank you for this!
I only noticed one thing:
The project
option seems to expect a path relative from the specified rootDir
; am i correct in this?
Because the entryFile
seems to require a path relative from the directory where scss-bundle
was called.
For example;
project
equal to ./
does not work; same import error.entryFile
equal to _theme.scss
does not work, file not found error.Is this the expected behavior? Because it strikes me as a bit odd.
@MalumAtire832 I think I know where is the problem. Could you test with new canary version (scss-bundle@0.0.0-canary.ad13f8e
)?
@jefferywroblewski-accesso ignoreImports
is not working for ~@material/.*
{
entryFile: 'libs/theme/src/lib/safire-theme.scss',
outFile: 'libs/theme/dist/theme.scss'
},
{
entryFile: 'libs/theme/src/lib/utilities.scss',
outFile: 'libs/theme/dist/utilities.scss'
},
{
ignoreImports: ['~@material/.*'],
entryFile: 'libs/components/button/src/scss/button.scss',
outFile: 'libs/components/button/src/dist/button-theming.scss'
}
];
Am using "scss-bundle": "^3.0.2",
Thanks @MartynasZilinskas! I'm using scss-bundle@0.0.0-canary.ad13f8e
with --config
flag and project
property and it's working fine for me. This is my .config.json
:
{
"bundlerOptions": {
"entryFile": "./src/components/src/components.theme.scss",
"rootDir": "",
"project": "../../",
"outFile": "./dist/components/theming.scss",
"ignoreImports": [
"~@angular/.*"
],
"logLevel": "debug"
}
}
I am using the same config with scss-bundle@0.0.0-canary.ad13f8
and it's not working:
There is an error in your styles:
Can't find stylesheet to import.
?
1 ¦ @import '~@angular/material/theming';
¦ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
?
stdin 1:9 root stylesheet on line (1, 9)
Why is it even trying to resolve the file if it's specifically ignored?
This still seems to be an issue in 3.1.1 even when following the guidance above.
Calling from workspace root (where node_modules) is and setting project config to "./" or leaving blank does not solve the problem.
Describe the bug
ignoreImports
option does not seem to work with~@angular/material/theming
imports.To Reproduce toolbar.component-theme.scss
components.scss
index.scss
scss-bundle.config.json
Expected behavior The
~@angular/material/theming
imports should be ignored and the files should be bundled.Package version: v3.0.2 Node version: v12.13.0 OS: Windows 10 - 1903