2

I have created a Vue project with Typescript having components in class style. I need to include some external CSS file - like from Amazon S3. The CSS doesn't seems to be loaded.

In the network section I can see it.

enter image description here

Krishna
  • 1,089
  • 5
  • 24
  • 38
  • 1
    Can you post how you included the CSS file, And how did you created project ? Did you used `vue-cli` or ? – Satyam Pathak Aug 28 '19 at 06:53
  • Yes I used vue-cli. I included Babel, TS, TSlint, ... I included simply using `` in index.html Updated my question – Krishna Aug 28 '19 at 06:55
  • Possible duplicate of [How to include css files in Vue 2](https://stackoverflow.com/questions/43784202/how-to-include-css-files-in-vue-2) – channasmcs Aug 28 '19 at 07:07

2 Answers2

5

I suggest you to use preprocessor

Install SASS -

npm install -D sass-loader sass

then You will be able to import it in your App.vue

<style lang="scss">
@import './static/css/style.css';
</style>

Update

I figured out one more way to include single css file.

In your App.vue, you can add css file to style src

<style src="relative-path/style.css"></style>
Satyam Pathak
  • 6,612
  • 3
  • 25
  • 52
4

you can load external URL

<style lang="scss or less">
    @import "https://external_url_.css";
    @import ".../assest/_.css";
</style>

you can load css loaders installed if you more such as sass-loader, css-loader , less-loader npm

channasmcs
  • 1,104
  • 12
  • 27