Skip to content

Instantly share code, notes, and snippets.

@trey
Last active July 13, 2019 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trey/7eb29f66c1918b35b0eb8255db9ce2b9 to your computer and use it in GitHub Desktop.
Save trey/7eb29f66c1918b35b0eb8255db9ce2b9 to your computer and use it in GitHub Desktop.
Starting to get Laravel Mix to be the new Blank Slate

Starting to get Laravel Mix to be the new Blank Slate

I was trying to recreate my Blank Slate project using Laravel Mix, but I didn't quite get there. Two main things are still holding me up.

  1. I cannot figure out how to get SVG sprites to work like I had them before (or at all).
  2. Changes to Sass files reload the entire page rather that just reloading in place.

Helpful links:

{
"name": "testing-mix",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "concurrently \"http-server ./dist\" \"npm run development -- --watch\"",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.26.7",
"browser-sync-webpack-plugin": "^2.0.1",
"concurrently": "^4.1.1",
"cross-env": "^5.2.0",
"http-server": "^0.11.1",
"laravel-mix": "^4.1.2",
"laravel-mix-svg-sprite": "^1.0.0",
"mix-html-builder": "^0.3.0",
"posthtml-include": "^1.2.0",
"posthtml-loader": "^1.0.1",
"resolve-url-loader": "^3.1.0",
"sass": "^1.22.4",
"sass-loader": "^7.1.0"
}
}
let mix = require('laravel-mix');
require('laravel-mix-svg-sprite');
require('mix-html-builder');
mix
.html()
.sass('src/css/main.scss', 'dist/css/')
.svgSprite('src/img/svg/*.svg', 'dist/img/sprites.svg')
.disableNotifications()
.browserSync({
proxy: 'localhost:8080',
files: 'dist/**',
open: false
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment