Git Product home page Git Product logo

vue-cli-plugin-windicss's Introduction

⚠️ Windi CSS is Sunsetting ⚠️
We are sunsetting Windi CSS and we recommend new projects to seek for alternatives. Read the full blog post.


Windi CSS Logo
Windi CSS

Npm Version Total Downloads Build Status Coverage
Discord Chat

Next generation utility-first CSS framework.

Why Windi CSS? 🤔

A quote from the author should illustrate his motivation to create Windi CSS:

When my project became larger and there were about dozens of components, the initial compilation time reached 3s, and hot updates took more than 1s with Tailwind CSS. - @voorjaar

By scanning your HTML and CSS and generating utilities on demand, Windi CSS is able to provide faster load times and a speedy HMR in development, and does not require purging in production.

Read more about it in the Introduction.

Integrations

Windi CSS provides first-class integrations for your favorite tools, select yours and get started.

Frameworks Package Version
CLI Built-in
VSCode Extension windicss-intellisense
Vite vite-plugin-windicss
Rollup rollup-plugin-windicss
Webpack windicss-webpack-plugin
Nuxt nuxt-windicss
Svelte svelte-windicss-preprocess
StencilJS stencil-windicssCommunity

Plugins 🛠

Check out plugins available for windicss.

Documentation 📖

Check the documentation website.

Discussions

We’re using GitHub Discussions as a place to connect with other members of our community. You are free to ask questions and share ideas, so enjoy yourself.

Contributing

If you're interested in contributing to windicss, please read our contributing docs before submitting a pull request.

Sponsors

Backers

License

Distributed under the MIT License.

vue-cli-plugin-windicss's People

Contributors

hannoeru avatar harlan-zw avatar menghany avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vue-cli-plugin-windicss's Issues

An incomprehensible bug.

@vue/cli 5.0.8
node v16.17.0
vue 3.2.47
vue-cli-plugin-windicss 1.1.6
unplugin-auto-import 0.16.4
unplugin-vue-components 0.24.1

Once I include the "vue-cli-plugin-windicss" plugin in my "package.json" file,

devDependencies:{
"vue-cli-plugin-windicss": "^1.1.6",
}

my page will look like this:
image

On the contrary, if I remove this plugin and run the command "vue-cli-service serve" again, the page will look like this, everything will be back to normal.
image

I swear I have never written this strange code anywhere.

var _ = require("!!../node_modules/lodash/lodash.js");module.exports = function (templateParams) { with(templateParams) {return (function(data) { var __t, __p = ''; __p += '\n\n \n \n \n \n \n \n \n \n \n
\n \n\n'; return __p })();}}

Cannot read property 'extraTransformTargets' of undefined

node v14.16.0

TypeError: Cannot read property 'extraTransformTargets' of undefined
at Object.isDetectTarget (F:\Projects\wocenter-admin-ui\node_modules@windicss\plugin-utils\dist\index.js:662:29)
at Object.include [as resource] (F:\Projects\wocenter-admin-ui\node_modules\windicss-webpack-plugin\dist\plugin.cjs:159:40)
at RuleSet._run (F:\Projects\wocenter-admin-ui\node_modules\webpack\lib\RuleSet.js:492:30)
at RuleSet._run (F:\Projects\wocenter-admin-ui\node_modules\webpack\lib\RuleSet.js:547:10)
at RuleSet.exec (F:\Projects\wocenter-admin-ui\node_modules\webpack\lib\RuleSet.js:475:8)
at F:\Projects\wocenter-admin-ui\node_modules\webpack\lib\NormalModuleFactory.js:270:34
at F:\Projects\wocenter-admin-ui\node_modules\neo-async\async.js:6883:13
at F:\Projects\wocenter-admin-ui\node_modules\webpack\lib\NormalModuleFactory.js:215:9
at F:\Projects\wocenter-admin-ui\node_modules\enhanced-resolve\lib\Resolver.js:180:13
at F:\Projects\wocenter-admin-ui\node_modules\enhanced-resolve\lib\Resolver.js:284:24
at eval (eval at create (F:\Projects\wocenter-admin-ui\node_modules\tapable\lib\HookCodeFactory.js:33:10), :12:1)
at F:\Projects\wocenter-admin-ui\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:43:26
at F:\Projects\wocenter-admin-ui\node_modules\enhanced-resolve\lib\Resolver.js:284:24
at eval (eval at create (F:\Projects\wocenter-admin-ui\node_modules\tapable\lib\HookCodeFactory.js:33:10), :12:1)
at F:\Projects\wocenter-admin-ui\node_modules\enhanced-resolve\lib\Resolver.js:284:24
at eval (eval at create (F:\Projects\wocenter-admin-ui\node_modules\tapable\lib\HookCodeFactory.js:33:10), :27:1)
npm ERR! code ELIFECYCLE

SyntaxError on build Unclosed string

I've been trying out Windi CSS and Vue CLI 4, which has been working great with npm run serve but now I've come to build, I keep running into SyntaxError Unclosed string errors.

image

After trying to escape or remove the empty pseudo content:"";, I just run into similar errors, so something's not right 🤔

image

There's nothing helpful in the logs and npm run lint doesn't return any errors.

Any help much appreciated!

Here's my setup...

// package.json
{
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build --modern",
    "lint": "vue-cli-service lint",
    "report": "vue-cli-service build --modern --report --report-json"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^2.6.11",
    "vue-router": "^3.2.0",
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@windicss/plugin-animations": "^1.0.9",
    "@windicss/plugin-question-mark": "^0.1.1",
    "@windicss/plugin-scrollbar": "^1.2.3",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "sass": "^1.26.5",
    "sass-loader": "^10",
    "vue-cli-plugin-windicss": "^1.0.4",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/strongly-recommended",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {
      "vue/max-attributes-per-line": 0,
      "vue/singleline-html-element-content-newline": 0,
      "vue/no-unused-vars": "off",
      "no-unused-vars": "off"
    },
    "globals": {
      "__webpack_public_path__": "writable"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 2%",
    "not dead",
    "last 2 versions",
    "not ie <= 11",
    "safari >= 10",
    "iOS >= 10"
  ]
}
// vue.config.js
module.exports = {
  productionSourceMap: false,
  css: {
    extract: false,
    loaderOptions: {
      postcss: {
        config: {
          path: __dirname
        }
      }
    }
  }
}

Additional notes:

  • SCSS syntax looks okay across the board.
  • SCSS is written within components using <style lang="scss">.
  • I was using Vue CLI 3 before installing vue-cli-plugin-windicss and before using Windi with no issues.

It does't work anyway.

Hi, I tried a couple of hours trying to find the problem, but I failed.
version:
@vue/cli 4.4.6

In my vue.config.js:

// vue.config.js
module.exports = {
  pluginOptions: {
    windicss: {
      // see https://github.com/windicss/vite-plugin-windicss/blob/main/packages/plugin-utils/src/options.ts
      scan: {
        dirs: ['./'],
        exclude: ['node_modules', '.git'],
      },
    },
  },
}

also tried:

// vue.config.js
module.exports = {
  pluginOptions: {
    windicss: {
      // see https://github.com/windicss/vite-plugin-windicss/blob/main/packages/plugin-utils/src/options.ts
      scan: {
        dirs: ['src', 'public', 'views'], // because my html files are in the views directory.
        exclude: ['node_modules', '.git'],
        include: ['views'] // I also tried to add it at here.
      },
    },
  },
}

Do I need to import windicss manually?

utility groups won't work when building project

I tried Utility Groups feature:

 .bg-gray-200 hover:(bg-gray-100 text-red-300)

Code above works well when I use yarn serve or npm run serve, but won't work when I tried to build the project.

Vue Cli: 4.5
Vue: 3+

error [email protected]: The engine "node" is incompatible with this module. Expected version "^12.20.0 || ^14.13.1 || >=16.0.0". Got "12.19.0"

vue add windicss

📦 Installing vue-cli-plugin-windicss...

yarn add v1.22.4
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "^12.20.0 || ^14.13.1 || >=16.0.0". Got "12.19.0"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error Found incompatible module.
ERROR command failed: yarn add vue-cli-plugin-windicss -D --tilde

Color modify in tailwindcss.config.js not applied

Hi!

I would like to report a bug. I followed instruction and setup success plugin to vue-cli v4. Everything seem working perfect with default, but when i try to modify color pallette site not apply new color, but from Windi css: analysis command (windicss vscode extension) i saw color reported as changed.

Look like vscode's extension compile correct, but vue-cli plugin compile not correct.

This is my tailwind.config.js:

const colors = require('windicss/colors');

module.exports = {
  important: true,
  darkMode: 'class', // or 'media' or 'class'
  theme: {
    extend: {
      container: {
        center: true,
        padding: '1.5rem',
      },
      screens: {
        // add media print screen
        print: { raw: 'print' },
      },
      colors: {
        cyan: colors.cyan,
        primary: colors.emerald,
        green: colors.emerald,
        gray: colors.blueGray,
      },
    },
  },
  variants: {
    extend: {
      display: ['group-hover'],
      visibility: ['group-hover'],
      borderWidth: ['first', 'last'],
      borderRadius: ['first', 'last'],
    },
  },
};

Colors: primary show purple, not emerald. grayshow default, not cool gray etc.


Update: After spend a hour testing and play with config. i found we have some issue:

  1. In README i saw we have meantion:
    If you have a tailwind.config.js, please rename it to windi.config.js or windi.config.ts.. This message is important, but stay in small position and hard to catch by eyes.
  2. Although had meantion about "must use filename windi.config.{js|ts} but actually i still can leave filename tailwind.config.{js|ts} and add one more property config: "..." in vue.config.js like this:
pluginOptions: {
    windicss: {
      // see https://github.com/windicss/vite-plugin-windicss/blob/main/packages/plugin-utils/src/options.ts
      scan: {
        dirs: ['./src'],
        exclude: [
          'node_modules',
          '.git',
          'public/**/*',
          '*.template.html',
          'index.html',
          'dist',
        ],
        include: [],
      },
      transformCSS: 'pre',
      compile: false,
      config: 'tailwind.config.js' // <- here , copy from config of other windicss plugin
    },
  },

Plugin will working normally, no throwing any warning and error, but look like content not be read and lead to issue i reported above (about color not applied).

  1. If i leave property config: "..." in vue.config.js and change filename tailwind.config.* to windi.config.* when running vue-cli i will get mesasge not found config file.
  2. if i remove config: "..." and change filename to windi.config.* then everything work perfect. Config file applied.

So... I think i found workaround, but it still be a bug. Hope my explains help plugin can be fixed.

Thank you!!

Important Prefix not working or causes SassError

The Important Prefix doesn't seem to be working for me in Vue CLI.

For example, p-2 works as expected.

When using <div class="!p-2"> the class has no affect.

When using @apply !p-2; I receive a Syntax Error: SassError: expected ";"

My setup:

"dependencies": {
    "core-js": "^3.6.5",
    "vue": "^2.6.11",
    "vue-horizontal": "^0.8.10",
    "vue-router": "^3.2.0",
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@windicss/plugin-question-mark": "^0.1.1",
    "@windicss/plugin-scrollbar": "^1.2.3",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "sass": "^1.26.5",
    "sass-loader": "^10",
    "vue-cli-plugin-windicss": "^1.0.4",
    "vue-template-compiler": "^2.6.11"
  },

Classes are ignored on index.html file

Hi,

I'm trying to to add styles to the body on a Vue CLI 4 app, but the classes are ignored by the plugin. The style are not generated.
image

I tried to force the scanning with the extract.include option or the pluginOptions, with no effect.

To reproduce :

  • vue create vue-app
  • vue add windicss
  • add bg-red-500 to the body
  • npm run serve

On @vue/cli 4.5.12


Edit:
Seeing the plugin source, i can see that the public folder and index.html are ignored by default, which seems to come from the windi webpack plugin ?

Tried to override it, I had to add my classes to the safelist option.
This is a real downside for me compared to the vite plugin, who directly works with index.html.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.