Logbuch
browsersync reload on sass / scss
Browsersync not reloading or injecting css changes - workaround
Let´s say you have a file structure like this:
build
-script
--default.min.js
-styles
--default.min.css
js
-default.js
sass
_head.scss
_body.scss
_footer.scss
default.css
On every scss change grunt (should work with gulp as well) will generate a new default.min.css file in your build/styles folder without reloading the browser in connection the old file is updated or replaced. The trick is, that browsersync doesn´t trigger on css but on scss file extensions. So the only thing you have to do is to generate the default.min.css twice for example as default-reload.scss inside the build/styles folder and browsersync will trigger at the right time.
So if you are using the grunt-contrib-cssmin plugin add another task like this:
cssmin: {
...
default: {
files: {
'build/styles/default.min.css': 'sass/default.css'
},
},
/*only needed for browserSynctrigger*/
syncTrigger: {
files: {
'build/styles/default-reload.scss': 'sass/default.css'
},
},
},
That´s it. Maybe there is a faster way, if you use concat and duplicate the default.css.min file an just rename it to .scss. Leave a comment the way you did it.
Blog News
Blog Cloud
- Accordion
- Affinity
- Allen & Heath
- Apple
- Benutzer
- Browser
- Bug
- Chrome
- CMS
- Contao
- Contao 4
- Controller
- Crative Suite
- CS6
- CSS
- DB2
- Design
- Erweiterung
- Festivals
- Font
- Fonts
- Grundlinienraster
- grunt
- Hardware
- Hosting
- House
- HTML5
- IE7
- Indesign
- Internet
- iOS
- iPad
- iTunes
- Layout
- Live
- Mac
- Mac Book
- Mamp
- Mischpult
- Mixer
- mobiler
- Mukke
- Music
- Netzwerk
- OS X
- OSX
- PC
- Pfronten
- Photo
- php
- Player
- Preview
- Publisher
- Quark
- Quark XPress
- Raster
- Reisen
- Router
- safari
- Schlüsselbund
- schneiden
- Schriften
- Script
- SEO
- Server
- Set
- Shell Script
- Slider
- Smartwatch
- Snow Board
- Software
- Soundkarte
- SSD
- syncen
- Synology
- Techno
- Terminal
- thunderbolt
- Time Mashine
- Traktor
- Trimm
- Tweets
- Typografie
- typografisches Raster
- typoman
- Unterstützung
- Up
- Video
- Vite
- Web
- Webfont
- Webfonts
- Webserver
- Website
- Wifi
- Windows
- Wlan
- Xone
Kommentare