Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Laravel Mixではじめるwebpack

井上拓
February 16, 2019

Laravel Mixではじめるwebpack

広島フロントエンド勉強会 Vol.24の発表資料

井上拓

February 16, 2019
Tweet

More Decks by 井上拓

Other Decks in Programming

Transcript

  1. ޿ౡϑϩϯτΤϯυษڧձ σβΠϯ෦ • 2017೥4݄1೔ʹൃ଍ • 10ճ։࠵ • ͍͍ͩͨ2ϱ݄ʹ1ճ։࠵ ޿ౡͰwebσβΠϯΛओ࣠ʹͨ͠ษڧձ͕গͳ͘ɺ৘ใڞ༗Ͱ͖Δίϛϡχ ςΟʔ΋গͳ͍ͱͷ૬ஊΛड͚ɺ޿ౡϑϩϯτΤϯυษڧձͷ࢞ຓษڧձͱ

    ͯ͠ʮ޿ౡϑϩϯτΤϯυษڧձʙσβΠϯ෦ʙʯΛ্ཱͪ͛·ͨ͠ɻ πʔϧͷ࢖͍ํ͔ΒจࣈαΠζ΍ߦؒ͸Ͳ͏΍ܾͬͯΊΔ͔ͳͲૉ๿ͳٙ໰ ·ͰɺࢀՃऀશһͰ৘ใΛڞ༗͠ɺ޿ౡͷwebσβΠϯͷϨϕϧΞοϓΛ໨ ࢦ͠·͢ɻ
  2. Laravel Mixʹඞཁͳ΋ͷ MT BQQ   OPEF@NPEVMFT  SPVUFT BSUJTBO

      QBDLBHFMPDLKTPO TFSWFSQIQ CPPUTUSBQ  QBDLBHFKTPO  TUPSBHF DPNQPTFSKTPO QIQVOJUYNM  UFTUT DPNQPTFSMPDL QVCMJD  WFOEPS DPOpH  SFBENFNE  XFCQBDLNJYKT EBUBCBTF SFTPVSDFT
  3. { "private": true, "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": "npm run development -- --watch", "watch-poll": "npm run watch -- --watch-poll", "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" }, "devDependencies": { "axios": "^0.18", "bootstrap": "^4.0.0", "cross-env": "^5.1", "jquery": "^3.2", "laravel-mix": "^4.0.7", "lodash": "^4.17.5", "popper.js": "^1.12", "resolve-url-loader": "^2.3.1", "sass": "^1.15.2", "sass-loader": "^7.1.0", "vue": "^2.5.17", "vue-template-compiler": "^2.5.22" } } QBDLBHFKTPO
  4. var Vue = require('vue') var app = new Vue({ el:

    '#app', data: { message: 'Hello Laravel Vue!' } }) WVFBQQKT
  5. { "private": true, "scripts": { ~~ུ~~ }, "devDependencies": { "axios":

    "^0.18", "bootstrap": "^4.0.0", "cross-env": "^5.1", "jquery": "^3.2", "laravel-mix": "^4.0.7", "lodash": "^4.17.5", "popper.js": "^1.12", "resolve-url-loader": "^2.3.1", "sass": "^1.15.2", "sass-loader": "^7.1.0", "vue": "^2.5.17", "vue-template-compiler": "^2.5.22" } } QBDLBHFKTPO
  6. const mix = require('laravel-mix'); mix.js('resources/js/app.js', 'public/js') .vue('resources/js/vueapp.js', 'public/js') .sass('resources/sass/app.scss', 'public/css')

    .sass('resources/sass/style.scss', 'public/css') .sourceMaps() mix.webpackConfig({ devtool: "inline-source-map" }); XFCQBDLNJYKT
  7. const mix = require('laravel-mix'); mix.js('resources/js/app.js', 'public/js') .vue('resources/js/vueapp.js', 'public/js') .sass('resources/sass/app.scss', 'public/css')

    .sass('resources/sass/style.scss', 'public/css') mix.browserSync({ server: 'public', proxy: false, files: [ 'public/**/*.html', 'public/js/*.js', 'public/css/*.css', ] }) XFCQBDLNJYKT
  8. const mix = require('laravel-mix'); mix.js('resources/js/app.js', 'public/js') .vue('resources/js/vueapp.js', 'public/js') .sass('resources/sass/app.scss', 'public/css')

    .sass('resources/sass/style.scss', 'public/css') ɹɹ .options({ autoprefixer: { browsers: ['last 2 versions'], options: { grid: true, } } }); XFCQBDLNJYKT
  9. const mix = require('laravel-mix'); mix.js('resources/js/app.js', 'public/js') .vue('resources/js/vueapp.js', 'public/js') .sass('resources/sass/app.scss', 'public/css')

    .sass('resources/sass/style.scss', 'public/css') ɹɹ .options({ postCss: [ require('css-mqpacker')() ], autoprefixer: { browsers: ['last 2 versions'], options: { grid: true, } } }); XFCQBDLNJYKT