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

Vue meet up sapporo Vue + Storybook導入について

redamoon
April 19, 2019
53

Vue meet up sapporo Vue + Storybook導入について

redamoon

April 19, 2019
Tweet

Transcript

  1. cd ~/workspace vue create vue-storybook // Manually select features cd

    vue-storybook/ yarn add -D vue-loader sass-loader node-sass @babel/core babel-loader babel-preset-vue touch vue-config.js # Vue + Stoybookಋೖखॱ ## Vue cliͰ؀ڥߏஙʢ։ൃ؀ڥߏஙࡁΈ͸ෆཁʣ $IFDLUIFGFBUVSFTOFFEFEGPSZPVSQSPKFDU#BCFM 3PVUFS 7VFY -JOUFS 6TFIJTUPSZNPEFGPSSPVUFS  3FRVJSFTQSPQFSTFSWFSTFUVQGPSJOEFYGBMMCBDLJOQSPEVDUJPO :FT 1JDLBMJOUFSGPSNBUUFSDPOpH4UBOEBSE 1JDLBEEJUJPOBMMJOUGFBUVSFT-JOUPOTBWF 8IFSFEPZPVQSFGFSQMBDJOHDPOpHGPS#BCFM 1PTU$44 &4-JOU FUD *OEFEJDBUFEDPOpHpMFT 4BWFUIJTBTBQSFTFUGPSGVUVSFQSPKFDUT /P ઃఆ಺༰
  2. const path = require('path') module.exports = { configureWebpack: { resolve:

    { alias: { '@': path.join(__dirname, '/src') } } }, css: { loaderOptions: { sass: { data: `@import "./src/assets/scss/style.scss";` } }, sourceMap: true } } # Vue + Stoybookಋೖखॱ ## vue-config.js
  3. cd ~/workspace/vue-storybook/ yarn add -D @storybook/vue mkdir {stories,\.storybook} touch {stories/index.js,\.storybook/config.js,\.storybook/

    webpack.config.js} ˞storybook cli͸࢖༻ͤͣ # Vue + Stoybookಋೖखॱ ## Install Storybook
  4. # Vue + Stoybookಋೖखॱ ## vi package.json "scripts": { "storybook":

    "start-storybook -p 9000", "build-storybook": "build-storybook -c .storybook -o storybook-build" }
  5. # Vue + Stoybookಋೖखॱ ## .storybook/config.js import { configure }

    from '@storybook/vue'; const loadStories = ()=> { require('../stories/index.js'); } configure(loadStories, module);
  6. # Vue + Stoybookಋೖखॱ ## .storybook/webpack.config.js const path = require('path');

    module.exports = { module: { rules: [ { test: /\.scss$/, loaders: ['style-loader', 'css-loader', 'sass-loader'], include: path.resolve(__dirname, '../'), }, ], }, };
  7.  ωοτʹ͋Δ"EEPOͷઃఆํ๏Ͱ͸ಈ͔ͳ͍৔߹͕͋ΔͨΊɺඞͣެࣜΛࢀর͢Δ͜ͱ  طଘϓϩδΣΫτͰ͸ɺඞͣ͠΋ಉσΟϨΫτϦʹΠϯετʔϧ͠ͳ͍έʔε΋͋ΔͨΊ ࠶ݱͤ͞ΔͨΊͷύεมߋɾϥΠϒϥϦ͕ඞཁ  ϓϩδΣΫτͰ࢖༻͍ͯ͠Δ/PEFόʔδϣϯ͕ݹ͍ͱಈ࡞͠ͳ͍έʔε͕͋ΔͨΊόʔ δϣϯʹ߹ΘͤΔ͔/PEFΛΞοϓσʔτ͢Δඞཁ͕͋Δ  طଘίʔυͷσʔλ͸࠶ݱ͠ਏ͍ͨΊɺ4UPSZCPPL༻ͷελϒ͕ඞཁ

     ೋॏ؅ཧʹͳͬͯ͠·͏͕طଘίϯϙʔωϯτ͔Βݺͼग़͢ΑΓɺ4UPSZCPPL༻ͷίϯϙʔ ωϯτͰදࣔͤͨ͞΄͏͕ελΠϧϞοΫͷௐ੔͕͠΍͍͢  UFNQMBUFݺͼग़͠෦෼ΛϝιουνΣʔϯͰܨ͛ͯهड़͢ΔͨΊɺίʔυࣗମͷݟ௨͕͠ ྑ͘ͳ͍ͨΊϥοϓ༻ίϯϙʔωϯτΛ࡞Δͱݟ΍͍͢  ֶशίετ໘͕ߴ͍ʢΞοϓσʔτʹΑΔهड़มߋͳͲʣ # ಋೖͷॴײ