Skip to content

How/where I can import sass/css/less files ? #1

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
netanelwebzi opened this issue Oct 22, 2016 · 6 comments
Closed

How/where I can import sass/css/less files ? #1

netanelwebzi opened this issue Oct 22, 2016 · 6 comments

Comments

@netanelwebzi
Copy link

Hey

I installed from example bootstrap from npm.
Then I want to import the bootstrap css/less files and I cant understand where.
When I try to import it in app.js file I get an error that I dont have relevant loader.

So can you explain how I need to import global modules css/sass/less in the project ?

@atinux
Copy link
Owner

atinux commented Oct 22, 2016

Hi!

Could you provide me your app.js file please?

I believe you should import your less files inside App.vue

@netanelwebzi
Copy link
Author

netanelwebzi commented Oct 22, 2016

@atinux
Thats the App.vue file
`

`

Thats app.js file

import Vue from 'vue'
import store from './store'
import router from './router'
import { sync } from 'vuex-router-sync'
sync(store, router)

import App from './App.vue'
const app = new Vue({
router,
store,
...App
})

export { app, router, store }

In the app.js file I try to add something like this:

import 'bootstrap/less/bootstrap.less

or even css file

import 'bootstrap/dist/css/bootstrap.css

and when I run it I get console error:

ERROR in ./~/bootstrap/less/bootstrap.less
Module parse failed: /home/webninja101/Documents/vue-playground/ivsense/node_modules/bootstrap/less/bootstrap.less Unexpected character '@' (8:0)
You may need an appropriate loader to handle this file type.

Can you give me code snippet for thats to work and where to put that ?

@atinux
Copy link
Owner

atinux commented Oct 22, 2016

Ok, in your App.vue file, you should be able import bootstrap like this:

<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template> 

<style src="bootstrap/less/bootstrap.less" lang="less"></style>

Think about installing the less and less-loader:

npm install --save-dev less less-loader

It's better to import it via the .vue file for extracting it for production 🚀

@atinux atinux closed this as completed Oct 22, 2016
@bisht-richa
Copy link

I need help for vue translation + gettext .

@2rohith2
Copy link

@atinux
I am facing the same issue of importing LESS as global in my project.
I tried including my LESS file in App.vue but when I try to use the variable from my LESS file in any Vue file, that css is not applied.

Any inputs for this.

@atinux
Copy link
Owner

atinux commented May 30, 2018

You need to create a variables.less file and import it in your Vue components @2rohith2

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants