0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Mac】Vue cliでsassを利用する

Last updated at Posted at 2020-08-05

https://cli.vuejs.org/guide/css.html

Pre-Processors

Macターミナル
# Sass
npm install -D sass-loader sass

Automatic imports

https://www.npmjs.com/package/vue-cli-plugin-style-resources-loader

Macターミナル
vue add style-resources-loader

vue.config.jsを編集

vue.config.js
const path = require('path')
module.exports = {
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'scss',
      patterns: [
        path.resolve(__dirname, './src/styles/*.scss'),
      ]
    }
  }
}

src/main.jsに追加

main.js
import Vue from 'vue'
import App from './App.vue'
import "./styles/style.scss";//ここで読み込む

Vue.config.productionTip = false

new Vue({
  render: h => h(App),
}).$mount('#app')

自動で反映

Macターミナル
npm run serve
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?