Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Imported CSS files paths are resolved differently with or without --bundle #545

Closed
NickIliev opened this issue May 30, 2018 · 2 comments
Closed
Assignees

Comments

@NickIliev
Copy link
Contributor

Imported CSS files are using relative vs absolute paths depending on if the build is CLI or with Webpack.
For example, let's assume we have a CSS file in app/views/style-common.css which will be imported in 'app/views/sub-page.android.css'

/* Not working with Webpack; Working with CLI build */
@import url("~/views/style-common.css");

/* Working with Webpack; Not Working with CLI build */
@import url("./style-common.css");


Label {
    background-color: brown;
    color: whitesmoke;
}

Steps to reporudece:

  • use this test app
  • build with tns run android and then build with tns run android --bundle. Both cases are requiring to change the CSS import path so that the styles from style-common.css can be loaded.

Note: this happens only when the views are nested (CSS on root level is working as both paths are identical)

@edusperoni
Copy link
Contributor

Is there any progress on this issue? It seems webpack treats "~" as "/src/". If you import like this, it works:

@import url("~/../app/views/style-common.css");

@vchimev vchimev removed their assignment Jul 22, 2019
@miroslavaivanova
Copy link
Contributor

This issue is not reproducible with NativeScript 6.0 and I'm closing it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants