Skip to content

Commit

Permalink
fix: remove broken code
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Mar 9, 2021
1 parent 3ed5810 commit 8c8def6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@ If you were previously using `@nuxtjs/tailwindcss`, please consult the [document

## Configuration

This module will resolve the option key with either `windicss` or `tailwindcss`.

- Default:
```js
windicss: {
scan: {
dirs: ['./'],
exclude: ['.nuxt/**/*']
exclude: ['.nuxt/**/*']
},
preflight: {
alias: {
// add nuxt aliases
'nuxt-link': 'a',
}
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ModuleOptions } from './types'
import { Options } from 'windicss-webpack-plugin/dist/interfaces'

declare module '@nuxt/types' {
interface NuxtConfig {
windicss: ModuleOptions
windicss?: Options
}
}

Expand Down
13 changes: 6 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Module, NuxtOptions } from '@nuxt/types'
import type { Configuration as WebpackConfig } from 'webpack'
import type { ModuleOptions } from './types'
import { requireNuxtVersion } from './compatibility'
import WindiCSSWebpackPlugin from 'windicss-webpack-plugin'
import { resolve } from 'upath'
import logger from './logger'
import defu from 'defu'
import { UserOptions } from '@windicss/plugin-utils'
import { Options } from 'windicss-webpack-plugin/dist/interfaces'

const windicssModule: Module<ModuleOptions> = function (moduleOptions) {
const windicssModule: Module<Options> = function (moduleOptions) {
const nuxt = this.nuxt
const nuxtOptions = this.nuxt.options as NuxtOptions

Expand All @@ -24,7 +24,7 @@ const windicssModule: Module<ModuleOptions> = function (moduleOptions) {
}
}
}
const options = defu.arrayFn(moduleOptions, nuxt.options.tailwindcss, nuxt.options.windicss, windicssOptions) as ModuleOptions
const options = defu.arrayFn(moduleOptions, nuxt.options.tailwindcss, nuxt.options.windicss, windicssOptions) as Options

requireNuxtVersion(nuxt.constructor.version, '2.10')

Expand All @@ -34,10 +34,9 @@ const windicssModule: Module<ModuleOptions> = function (moduleOptions) {
}

nuxt.hook('build:before', async () => {
const { windicssOptions } = options
await nuxt.callHook('windycss:config', windicssOptions)
await nuxt.callHook('windycss:config', options)

logger.debug('Post hook options', windicssOptions)
logger.debug('Post hook options', options)

this.extendBuild((config: WebpackConfig,) => {
// allow users to override the windicss config
Expand All @@ -46,7 +45,7 @@ const windicssModule: Module<ModuleOptions> = function (moduleOptions) {
config.plugins = []
}
config.plugins.push(
new WindiCSSWebpackPlugin(windicssOptions)
new WindiCSSWebpackPlugin(options)
)
})
// add plugin to import windi.css
Expand Down
4 changes: 0 additions & 4 deletions src/types.ts

This file was deleted.

0 comments on commit 8c8def6

Please sign in to comment.