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 }}
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
But when I think about it , this ^ is not related - becuase if I do cssFile:"app1.css"without--bundle then - app1.css is respected.
the problem is that it's not respected with --bundle
None of them worked.
It seems that app1.css with --bundle is not respected. Only app.css is respected.
changed the title [-]Applying global custom `cssFile` for the app using --bundle , is not respected[/-][+]Applying global custom `cssFile` using --bundle , is not respected[/+]on Jun 26, 2018
changed the title [-]Applying global custom `cssFile` using --bundle , is not respected[/-][+]Can't resolve '~/app' when applying global custom `cssFile` using --bundle [/+]on Jun 27, 2018
changed the title [-]Can't resolve '~/app' when applying global custom `cssFile` using --bundle [/-][+]Can't resolve '~/app' when applying a global custom `cssFile` (problem only with --bundle )[/+]on Jun 27, 2018
changed the title [-]Can't resolve '~/app' when applying a global custom `cssFile` (problem only with --bundle )[/-][+]Can't resolve '~/app' for `cssFile` [/+]on Jun 28, 2018
The nativescript-dev-webpack plugin uses different logic for loading the global css file compared to the build without webpack. The loading is performed by the bundle-config-loader and the code looks something like this (for Angular apps):
var application = require("tns-core-modules/application");
require("tns-core-modules/ui/styling/style-scope");
global.registerModule("./app.css", function () { return require("~/app"); });
application.loadAppCss();
As you can see it looks for ~/app by default. This should resolve to app.css. However, you can disable that loading and write a custom loader. Check out the repo bellow and follow the commits. Ping me if you have any questions. https://github.com/sis0k0/ns-custom-global-css
Update: Looks like we introduced some changes in NativeScript@6 that require changes in workaround provided by @sis0k0.
The global.registerModule should register "app.css" instead of "./app.css" (although you can register both - it does not hurt). Here is how the fix looks like, just in case someone is using this approach or stumbles upon this issue.
Activity
[-]Applying global custom `cssFile` for the app using --bundle , is not respected[/-][+]Applying global custom `cssFile` using --bundle , is not respected[/+][-]Applying global custom `cssFile` using --bundle , is not respected[/-][+]Can't resolve '~/app' when applying global custom `cssFile` using --bundle [/+][-]Can't resolve '~/app' when applying global custom `cssFile` using --bundle [/-][+]Can't resolve '~/app' when applying a global custom `cssFile` (problem only with --bundle )[/+][-]Can't resolve '~/app' when applying a global custom `cssFile` (problem only with --bundle )[/-][+]Can't resolve '~/app' for `cssFile` [/+]sis0k0 commentedon Jul 4, 2018
Hi, @RoyiNamir!
The
nativescript-dev-webpackplugin uses different logic for loading the global css file compared to the build without webpack. The loading is performed by thebundle-config-loaderand the code looks something like this (for Angular apps):As you can see it looks for
~/appby default. This should resolve toapp.css. However, you can disable that loading and write a custom loader. Check out the repo bellow and follow the commits. Ping me if you have any questions.https://github.com/sis0k0/ns-custom-global-css
vakrilov commentedon Aug 8, 2019
Update: Looks like we introduced some changes in NativeScript@6 that require changes in workaround provided by @sis0k0.
The
global.registerModuleshould register"app.css"instead of"./app.css"(although you can register both - it does not hurt).Here is how the fix looks like, just in case someone is using this approach or stumbles upon this issue.