An open API service indexing awesome lists of open source software.

https://github.com/jwygithub/vue-cli-plugin-inject-style

automatically introduce styles on a single page based on the path
https://github.com/jwygithub/vue-cli-plugin-inject-style

vue vue-cli

Last synced: 5 months ago
JSON representation

automatically introduce styles on a single page based on the path

Awesome Lists containing this project

README

          

# vue-cli-plugin-inject-style

automatically inject style files based on the style path


version
download
issues
license



## Install

### with pnpm

```sh
pnpm add vue-cli-plugin-inject-style -D
```

### with yarn

```sh
yarn add vue-cli-plugin-inject-style -D
```

### with npm

```sh
npm install vue-cli-plugin-inject-style -D
```

### with vue

```sh
vue add vue-cli-plugin-inject-style
```

## Option

```typescript
export interface InjectStyle {
/**
* @description style root
* @default src/style
*/
path: string;

/**
* @description style suffix
* @default ["scss","less"]
*/
suffixs: suffix[];
}
```

## Config

```javascript
// vue.config.js
const path = require('node:path');
const { defineConfig } = require('@vue/cli-service');
module.exports = defineConfig({
transpileDependencies: true,
css: {
sourceMap: false,
loaderOptions: {
// manual add
scss: {
additionalData: '@import "~@/styles/index.scss";'
}
}
},
pluginOptions: {
'vue-cli-plugin-inject-style': {
path: path.join(__dirname, 'src', 'style'),
suffixs: ['scss', 'less']
}
}
});
```