Coder Social home page Coder Social logo

windicss / windicss-analysis Goto Github PK

View Code? Open in Web Editor NEW
129.0 9.0 7.0 189 KB

πŸ” A visual analyzer for Windi CSS

Home Page: https://analysis-demo.windicss.org

License: MIT License

JavaScript 0.08% HTML 0.70% TypeScript 55.83% Vue 40.80% CSS 2.59%
windcss analyzer design-system

windicss-analysis'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.

windicss-analysis's People

Contributors

aki77 avatar alexanderniebuhr avatar antfu avatar charlesokwuagwu avatar iainsimmons avatar khill-fbmc avatar sibbng avatar voorjaar avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

windicss-analysis's Issues

Custom base path for generated preview website

Context

I have a Nuxt project and I want to deploy the analyzer report in the same dist folder with the static generated output of Nuxt, in short, as a sub-page of my website.

Basically, I'm running nuxt generate && windicss-analysis --html dist/styles and everything is exported fine, however, the linked resources all start with a leading / so when the browser tries to load them all result in a 404 since they are not in the root folder (i.e. they are in /styles/* instead of /*).

Possible solutions

  1. Try and remove the leading / from imported resources (it seems like Storybook does this)
  2. Add another flag when exporting to specify a base path, e.g. --base-path

[FEATURE-REQUEST] Offline Build Version of App

@antfu thanks for this idea. here some insights and ideas + changes (i have adapted for use withour server port running in vscode, in vscode I think we do not need real time update. Just run it again if you want insights. Same behavior expected since it is similar to coverage of test).

We would need to allow running the UI offline with loading saved report.json from file (including using vscode webview URI's)
I would open PR, but I do not know how to make a second vite config, to build an additonal version. would be great if we can have it as an addtional script build, like build:app & build:app-offline

a) we would need another html base struct...
https://github.com/windicss/windicss-analysis/blob/main/index.html

// output.html
<!DOCTYPE html>
<html lang="en">
<head>
  <script>
    window.localStorage.setItem("report", "###REPLACEJSON###")
  </script>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Windi Analyser</title>
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500&display=swap" rel="stylesheet">
  <script type="module" crossorigin src="###REPLACESCRIPT###"></script>
  <link rel="stylesheet" href="###REPLACESTYLE###">
</head>
<body>
  <div id="app"></div>
  
</body>
</html>

b) we would include additional loader, maybe combine them with if, or do two differnt functions

export async function fetchData(refetch = false) {
data.value = await fetch(`/api/report.json${refetch ? '?force=true' : ''}`)
.then(r => r.json())
return data.value
}

export async function fetchData(refetch = false) {
  data.value = await fetch(`/api/report.json${refetch ? '?force=true' : ''}`)
    .then(r => r.json())
  return data.value
}
export async function loadData() {
  data.value = JSON.parse(window.localStorage.getItem("report").toString())
  return data.value
}

c) we would need to choose which data to load, somehow (maybe based on some localStorage var)

fetchData()

if (something) {
loadData()
} else {
fetchData()
}

[STYLE] improve code block

it's prism code block, so style set. But should make it more dynamic to match VS Code themes, somehow. (dark theme with white code block, is bad for eyes at night)

Bildschirmfoto 2021-03-30 um 17 11 57

[BUG] Bundle of this package fails due to JSON

I need to bundle this extension (more runAnalysis function), so it works outside of DEBUG for VS Code Extension

import { runAnalysis } from "windicss-analysis";
[!] Error: Unexpected token (Note that you need @rollup/plugin-json to import JSON files)
node_modules\statuses\codes.json (2:7)
1: {
2:   "100": "Continue",
          ^
3:   "101": "Switching Protocols",
4:   "102": "Processing",
Error: Unexpected token (Note that you need @rollup/plugin-json to import JSON files)
    at error (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:5305:30)
    at Module.error (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:9750:16)
    at Module.tryParse (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:10156:25)
    at Module.setSource (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:10057:24)
    at ModuleLoader.addModuleSource (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:18396:20)
    at async ModuleLoader.fetchModule (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:18452:9)
    at async Promise.all (index 0)
    at async ModuleLoader.fetchStaticDependencies (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:18478:34)        
    at async Promise.all (index 0)
    at async ModuleLoader.fetchModule (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:18454:9)

npm ERR! code 1
npm ERR! path C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense
npm ERR! command failed
npm ERR! command C:\Program Files\PowerShell\7-preview\pwsh.exe -c cross-env NODE_ENV=production rollup -c

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Alexander\AppData\Local\npm-cache\_logs\2021-03-30T10_55_00_244Z-debug.log
 ERROR  npm failed with exit code 1

Monorepo support

Can you please add the ability to support monorepos from the VS Code Extension? I have my site under packages/site and cannot use the extension, but must run pnpx windicss-analysis in the appropriate subfolder.

[BUG] color adaption in VSCode Webview

some weird issue, all colors of page (page is in light mode) get adapted to VSCode theme (potentially with some VSCode override). But modals, such es preferences seem not to get adapted.

i wonder why..?

adaptedinLightmode3
adaptedinLightmode
notadaptedcolormodal

Windi Analyzer not working on Nuxt Js.

VS Code Extension
From v0.8.0 of Windi CSS Intellisense, it has this analyser built-in.

  1. Open a project using Windi CSS in VS Code
  2. Open the Command Palette (β‡§βŒ˜P / Ctrl+Shift+P)
  3. Run command: Windi CSS: Run & Open Analysis
    image
// windi.config.js

const typography = require('windicss/plugin/typography')
const aspect_ratio = require('windicss/plugin/aspect-ratio')

module.exports = {
    darkMode: 'class',
    plugins: [typography, aspect_ratio],
    theme: {
        extend: {
            colors: {
                primary: "#0074D9",
            },
        }
    },
    // Website not working when adding thisπŸ‘‡
    extract: {
    include: [
      'src/**/*.{vue,jsx,tsx,svelte}',
      'shared/**/*.{vue,ts}',
    ],
  }
}

Running

Nuxt @ v2.15.7
[email protected]

support svelte class directive

class:bg-red-900={type == "danger"}

bg-red-900 should be also included in analysis, maybe with some info, that it is depended on variable.. could be interesting for other framework languages too

svelte class directives

should support svelte class directives

the syntax is quite simple and always the same: class:<classname>=<boolean>

<div class:bg-red-500={true}>Hello world</div>

color gradients

somehow support gradients in color pallete. 🀯

<div
  class="bg-gradient-to-br from-fuchsia-400 to-indigo-600"
/>

Analyzer doesn't work with Nuxtv3

Created empty Nuxt project with npx nuxi and added windicss

Rendering works fine, styles are visible in the page, but analyzer doesn't work

import { defineConfig } from '@windicss/plugin-utils';

export default defineConfig({
  /**
   * Write windi classes in html attributes.
   * @see https://windicss.org/features/attributify.html
   */
  attributify: true,
  darkMode: 'class',
  extract: {
    include: ['*/**/*.{vue,html,jsx,tsx}'],
  },
})

image

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.