GithubHelp home page GithubHelp logo

stylify / packages Goto Github PK

View Code? Open in Web Editor NEW
422.0 4.0 9.0 7.53 MB

๐Ÿ’Ž Monorepository for Stylify packages. Stylify uses CSS-like selectors to generate Extremely optimized utility-first CSS dynamically based on what you write ๐Ÿ’Ž.

Home Page: https://stylifycss.com

License: MIT License

Dockerfile 0.15% HTML 12.07% JavaScript 3.10% TypeScript 73.99% CSS 9.65% Vue 0.40% Latte 0.11% Twig 0.14% Astro 0.37% Svelte 0.01%
css css-framework postcss javascript webpack utility-classes functional-css atomic-css nodejs nextjs

packages's People

Contributors

chz avatar jiraklu avatar machy8 avatar milespernicious 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

packages's Issues

Variables inside component names

const components = {
    'button-{$color}': 'display:block background-color:$color'
}

Dynamically generates component classes depending on used classnames - (button-{blue}, button-{red})

Content options tunning

Drop @

stylify-option
/stylify-option

Error message

Improve error message for content option, when the parsing fails

Add screens option

@stylify-screens
  screen: '(min-width: 123px)'
/@stylify-screens

Multiple components inside a key

  • Split by a comma.
  • Merge selectors of each component so no duplicate components are added.
const components = {
 'button, title': 'font-size:24px' // Generates two components button => font-size:24px, title => font-size:24px,
 'title': 'color:blue',
 'button': 'font-weight:bold'
}

The code above should have two components

  • button: font-size:24px font-weight:bold
  • title: font-size:24px color:blue

United Rollup builder

  • Move rollup builder into the class
  • Use in packages
  • Remove integrations from packages

On css property add hook

There should be a hook that can check or modifie added css property and vlaue. For example to restrict margin size from 1px or 2px to only 4px, 8px, 12px. It should be included in compiler.

Nested selectors inside plain selectors

const plainSelectors = {
  'article': {
   _: 'font-size:16px', // Generates article => font-size:16px
    'h1, h2, h3, h4': 'font-size:48px' // generates article h1, article h2, ... => font-size 48px
  }
}

Webpack plugin

A new package @stylify/webpack-plugin.

class StylifyPlugin {
    apply(compiler) {
        // Optional configuration.
        nativePreset.compiler.variables = {
            blue: 'steelblue'
        };

        // Create a new Bundler instance.
        const bundler = new Bundler({
            compiler: nativePreset.compiler,
            watchFiles: compiler.options.watch || false
        });

        // Customize bundles however you want.
        bundler.bundle([
            {
                outputFile: './index.css',
                files: ['./index.html']
            }
        ]);

        // You can change these hooks.
        // Just remember, the Stylify must be initialized before the build.
        compiler.hooks.beforeRun.tapPromise(StylifyPlugin.name, () => {
            return bundler.waitOnBundlesProcessed();
        });
        compiler.hooks.beforeRun.tapPromise(StylifyPlugin.name, () => {
            return bundler.waitOnBundlesProcessed();
        });
    }
}

To:

plugins: [
   new StylifyPlugin({
        // Required
        bundles: [],
        // Optional
        // If is dev => if dev is true, watchFiles will be true in bundler config by default (can be overriden by bundler config)
        // If not set, then try to check for compiler.options.watch otherwise the dev is false
        dev: false
        // Bundler config will override 
        bundler: { }
        // Additional hooks
        hooks: {
                name: callback
        },
        // Function that will be called inside the apply method and the plugin instance will be passed
        beforeApply: (plugin) {}
   })
],

Plugin config will be added into the options variable of the class inside the constructor like here https://stylify.dev/docs/integrations/nextjs.

constructor(options) {
        this.options = {
            ...{ isDev: false },
            ...options
        }
    }

CLI

  • Just an issue for storing ideas
  • Projects are mostly using bundlers like Vite, Webpack, Rollup, Esbuild
  • I have no idea for now what it should do and what benefits it would bring ยฏ\_(ใƒ„)_/ยฏ

Nuxt css limits and loader

  • If whole project css size is <= 50 Kb - load all into page, without loading stylify in production
  • Otherwise split and load stylify

Inline ignored elements are not matched correctly

Inline and self closing elements are not matched correctly and the classes of such element are not rewritten by selectors rewritter.
image

<code-editor
  class="box-shadow:$shadow1 padding:12px__0 height:70px margin-bottom:12px border-radius:$radius2"
  :defaultCode="variablesDefaultHtmlCode"
  readonly
/>

Nuxt module improvements

Hi and thanks for creating the nice Nuxt module ๐Ÿ’š I've checked implementation and there are some areas we could improve:

  • By convention, npm package name of nuxt modules is either nuxt-lib, @nuxtjs/lib, @lib/nuxt or lib/nuxt (as an entrypoint). It would be nice if we could rename it at the early stages to @stylify/nuxt. In the future, we might introduce a shortcut in nuxt.config to directly install the module by adding modules: ['stylify']
  • Using module builder your module keeps compatible with best practices of Nuxt 3. You can read more about here: https://v3.nuxtjs.org/docs/advanced/modules
  • In order to support Nuxt 3 and vite, you can replace webpack loader with an unplugin loader that works perfectly with both webpack and vite/rollup with one implementation.

Nuxt module tests

  • Use actual stylify.dev project for testing
  • Install packages
  • Run generate
  • Test generated stylify.css file

Jest + Puppeteer tests

The browser input needs to be tested for mutatin observer watch mode. A few classes must be added, and then dthe css can be checked. If the css get's updated, then the mutation observer works.

Hook when file is processed

  • When file is processed, there should be a hook that can modifie the bundle config for example add file paths by matching them in a content for Symfony and etc.

Migrate from ES6 classes to prototypes

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.