resolve path relative to public folder
See original GitHub issueI have mix copied semantic-sass assets from node_modules to public folder :
// /webpack.mix.js
mix.copy('node_modules/semantic-ui-sass/app/assets/images/', 'public/images/', false)
.copy('node_modules/semantic-ui-sass/app/assets/fonts/', 'public/fonts/', false)
.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
This is how it looks like after copying: source :
/node_modules
|+semantic-ui-sass
|+app
|+assets
|+fonts
|+semantic-ui
|-icons.eof
|-icons.otf
......
|+stylesheets
|+semantic-ui
|+elements
|_icon.scss
.......
dest:
/public
|+css
|-app.css
|+fonts
|-semantic-ui
|-icons.eot
|-icons.otf
|-icons.svg
|-icons.ttf
|-icons.woff
|-icons.woff2
Then imported icons inside /resource/assets/sass/app.scss
// resources/assets/sass/app.scss
@import 'node_modules/semantic-ui-sass/app/assets/stylesheets/semantic-ui/elements/icon';
After running npm run dev
, this is the result produced :
source:
src: font-url("semantic-ui/icons.eot");
src: font-url("semantic-ui/icons.eot?#iefix") format('embedded-opentype')
...
dest:
/* public/css/app.css */
@font-face {
src: font-url("./../../../node_modules/semantic-ui-sass/app/assets/fonts/semantic-ui/icons.eot");
font-url("./../../../node_modules/semantic-ui-sass/app/assets/fonts/semantic-ui/icons.eot") format("embedded-opentype");
.....
}
But this is want i want :
/* public/css/app.css */
@font-face {
src: font-url("fonts/semantic-ui/icons.eot");
src: font-url("fonts/semantic-ui/icons.eot");
.....
}
I was wondering is there some way to configure mix to resolve urls inside scss relative to production public folder instead of dependencies source folder without changing the source?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
resolve path relative to public folder · Issue #364 · laravel-mix ...
I was wondering is there some way to configure mix to resolve urls inside scss relative to production public folder instead of dependencies ......
Read more >Resolve-Path (Microsoft.PowerShell.Management)
The Resolve-Path cmdlet displays the items and containers that match the wildcard pattern at the location specified. The match can include files, folders, ......
Read more >python - How to resolve a relative path, relative to any directory
I'm aware of how to resolve a relative path like '..\input\file\hello.txt' to an absolute path, relative to the current working directory:
Read more >Relative fs.readFileSync paths with Node.js - Ultimate Courses
Relative paths will be resolved relative to the current working directory as determined by calling process.cwd() .
Read more >Relative and absolute paths, in the file system and on the web ...
realpath() command will convert a relative path to an absolute one. getcwd() will give you the current directory.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Aha!
Add this to your
webpack.mix.js
file:As referenced here.
Here’s what I did for relative asset paths:
webpack.mix.js
fonts.scss
App.vue
Offcourse these aren’t node-modules but they are a use case that can be applied to this issue.