Topic: Can we get path variable in Sass (ASKING AGAIN)
$roboto-font-path: "../font/roboto/" !default;
, but not for ANY of the images.
Please see the error below when I state @import '../node_modules/mdbootstrap/sass/mdb.scss'
:
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/01.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/02.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/03.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/04.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/05.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/06.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/07.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/08.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/overlays/09.png' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/svg/arrow_left.svg' in '/app/src'
ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module not found: Error: Can't resolve '../img/svg/arrow_right.svg' in '/app/src'
admin5 pro answered 7 years ago
Edyta Dabrowska answered 7 years ago
../img/overlays/01.png
-> /node_modules/mdbootstrap/img/overlays/01.png
for every path in _hover-effects.scss
file.
You can put this in variables in your project.
Regards, admin5 pro answered 7 years ago
- Add
"mdbootstrap": "^4.3.2"
to my package.json - In my own local style.scss file i have the following lines: `$roboto-font-path: "../node_modules/mdbootstrap/font/roboto/"; @import '../node_modules/bootstrap/scss/bootstrap.scss';`
- Run
npm install
npm install
.
I will even give you the solution:
_variables.scss
/*** Fonts ***/
$roboto-font-path: "../font/roboto/" !default;
should change to
/*** Fonts ***/
$roboto-font-path: "../font/roboto/" !default;
/*** Images ***/
$images-path: "../img/" !default;
AND
_hover-effects.scss
.pattern-1 {
background: url(../img/overlays/01.png);
}
should change to (for all patterns)
.pattern-1 {
background: url(#{$images-path}overlays/01.png);
}
AND
_carousels-basics.scss
.carousel-control-prev-icon {
background-image: url(../img/svg/arrow_left.svg);
}
.carousel-control-next-icon {
background-image: url(../img/svg/arrow_right.svg);
}
should change to
.carousel-control-prev-icon {
background-image: url(#{$images-path}svg/arrow_left.svg);
}
.carousel-control-next-icon {
background-image: url(#{$images-path}svg/arrow_right.svg);
}
This is a change that is simple to implement, will not break anything, and will allow anyone to be able to import the scss file. But if this is not changed, it means I now have to host my own npm repo where I basically have forked your github and just made this small change.
Please guys. I don't understand why you did this for fonts but not for images. admin5 pro answered 7 years ago
- Add
"mdbootstrap": "^4.3.2"
to my package.json - In my own local style.scss file i have the following lines: `$roboto-font-path: "../node_modules/mdbootstrap/font/roboto/"; @import '../node_modules/bootstrap/scss/bootstrap.scss';`
- Run
npm install
npm install
.
I will even give you the solution:
_variables.scss
/*** Fonts ***/
$roboto-font-path: "../font/roboto/" !default;
should change to
/*** Fonts ***/
$roboto-font-path: "../font/roboto/" !default;
/*** Images ***/
$images-path: "../img/" !default;
AND
_hover-effects.scss
.pattern-1 {
background: url(../img/overlays/01.png);
}
should change to (for all patterns)
.pattern-1 {
background: url(#{$images-path}overlays/01.png);
}
AND
_carousels-basics.scss
.carousel-control-prev-icon {
background-image: url(../img/svg/arrow_left.svg);
}
.carousel-control-next-icon {
background-image: url(../img/svg/arrow_right.svg);
}
should change to
.carousel-control-prev-icon {
background-image: url(#{$images-path}svg/arrow_left.svg);
}
.carousel-control-next-icon {
background-image: url(#{$images-path}svg/arrow_right.svg);
}
This is a change that is simple to implement, will not break anything, and will allow anyone to be able to import the scss file. But if this is not changed, it means I now have to host my own npm repo where I basically have forked your github and just made this small change.
Please guys. I don't understand why you did this for fonts but not for images. Edyta Dabrowska answered 7 years ago
Darío Blanco commented 7 years ago
Hi, There are like 4 Pull Requests in your open source project that weren't even addressed https://github.com/mdbootstrap/bootstrap-material-design/pull/78 https://github.com/mdbootstrap/bootstrap-material-design/pull/107 https://github.com/mdbootstrap/bootstrap-material-design/pull/136 https://github.com/mdbootstrap/bootstrap-material-design/pull/137 For such a small fix, that in my opinion requires not much development effort (and resolves a bug in the currentmdbootstrap
npm package, which is a plus), 8 months seem like a big time for addressing the change.
From the community I think we are more than willing to help and to patch it (me included if I have to create another Pull Request solving the current conflicts). Can we please give a solution to this? It will be much appreciated :)
Thanks!
Marta Szymanska staff pro premium answered 7 years ago
Marta Szymanska staff pro premium answered 7 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: Yes