All Projects → tomhodgins → Jsincss

tomhodgins / Jsincss

Licence: mit
A JS-in-CSS stylesheet loader

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Jsincss

Plumber
A swiss army knife CLI tool for interacting with Kafka, RabbitMQ and other messaging systems.
Stars: ✭ 514 (+970.83%)
Mutual labels:  event-driven
React Eventmanager
[Deprecated] Event-based simple React state management with decorators
Stars: ✭ 17 (-64.58%)
Mutual labels:  event-driven
Jes
Java Event Store implementation
Stars: ✭ 32 (-33.33%)
Mutual labels:  event-driven
Weevent
Event-Driven Architecture Based on Blockchain.基于区块链的事件驱动架构
Stars: ✭ 608 (+1166.67%)
Mutual labels:  event-driven
Swift Nio
Event-driven network application framework for high performance protocol servers & clients, non-blocking.
Stars: ✭ 6,777 (+14018.75%)
Mutual labels:  event-driven
Mbassador
Powerful event-bus optimized for high throughput in multi-threaded applications. Features: Sync and Async event publication, weak/strong references, event filtering, annotation driven
Stars: ✭ 877 (+1727.08%)
Mutual labels:  event-driven
Gnet
🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go./ gnet 是一个高性能、轻量级、非阻塞的事件驱动 Go 网络框架。
Stars: ✭ 5,736 (+11850%)
Mutual labels:  event-driven
Asombroso Ddd
Una lista cuidadosamente curada de recursos sobre Domain Driven Design, Eventos, Event Sourcing, Command Query Responsibility Segregation (CQRS).
Stars: ✭ 41 (-14.58%)
Mutual labels:  event-driven
Argo Events
Event-driven workflow automation framework
Stars: ✭ 821 (+1610.42%)
Mutual labels:  event-driven
Zeus
A high performance, cross-platform Internet Communication Engine. Developed with native socket API. Aim at handling millions of concurrent connections.
Stars: ✭ 30 (-37.5%)
Mutual labels:  event-driven
Ray
项目停止更新,新项目:https://github.com/RayTale/Vertex
Stars: ✭ 635 (+1222.92%)
Mutual labels:  event-driven
Pitstop
This repo contains a sample application based on a Garage Management System for Pitstop - a fictitious garage. The primary goal of this sample is to demonstrate several software-architecture concepts like: Microservices, CQRS, Event Sourcing, Domain Driven Design (DDD), Eventual Consistency.
Stars: ✭ 708 (+1375%)
Mutual labels:  event-driven
Nlp Knowledge Graph
自然语言处理、知识图谱、对话系统三大技术研究与应用。
Stars: ✭ 908 (+1791.67%)
Mutual labels:  event-driven
Beehive
A flexible event/agent & automation system with lots of bees 🐝
Stars: ✭ 5,348 (+11041.67%)
Mutual labels:  event-driven
Foxoffice
Sample application demonstrating how to build a distributed cloud .NET Core application based on CQRS and Event Sourcing.
Stars: ✭ 33 (-31.25%)
Mutual labels:  event-driven
Twisted
Event-driven networking engine written in Python.
Stars: ✭ 4,442 (+9154.17%)
Mutual labels:  event-driven
Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (-50%)
Mutual labels:  event-driven
Node.pas
Asynchronous Event-driven server programming for EMB Delphi, powered by libuv.
Stars: ✭ 45 (-6.25%)
Mutual labels:  event-driven
Eventing
Open source specification and implementation of Knative event binding and delivery
Stars: ✭ 980 (+1941.67%)
Mutual labels:  event-driven
Rails event store
A Ruby implementation of an Event Store based on Active Record
Stars: ✭ 947 (+1872.92%)
Mutual labels:  event-driven

jsincss

An event-driven virtual stylesheet manager

About

Jsincss is a plugin that allows you to use JavaScript to template the creation of CSS stylesheets at runtime based on events happening in the browser. This allows you to use JavaScript to easily extend CSS to include new features.

This plugin is a JavaScript module that loads JS-in-CSS stylesheets, manages the creation of <style> tags to output the processed stylesheets, and registers event listeners for reprocessing loaded stylesheets when changes occur in the browser.

Downloading

You can download jsincss and add it to your codebase manually, or download it with npm:

npm install jsincss

Another option is linking to the module directly from a CDN like unpkg:

<script type=module>
  import jsincss from 'https://unpkg.com/jsincss/index.vanilla.js'
</script>

Importing

You can import the plugin into your own JavaScript modules in a couple of ways.

The first way is using the native import statement in JavaScript. Here you can assign any name you want to the function you are importing, and you only need to provide a path to the plugin's index.vanilla.js file:

import jsincss from './index.vanilla.js'

You can also use require() to load this plugin instead with a bundler like Webpack or Parcel:

const jsincss = require('jsincss')

Once you have imported this plugin into your module, you can use the plugin as jsincss()

Using JS-in-CSS Stylesheets

The main goal of this plugin is to let people using a JS-in-CSS workflow load JIC stylesheets inside of a JavaScript module.

The plugin has the following format:

jsincss(stylesheet, selector, events)
  • stylesheet is a JavaScript function that returns a CSS stylesheet as a string
  • selector is string containing either 'window' or a CSS selector
  • events is an array of events to add event listeners for, quoted as strings: (eg. ['load', resize'])

The default selector is window, and the default list of events is ['load', 'resize', 'input', 'click', 'reprocess'].

You can also create and listen for custom events with JavaScript using new Event() and dispatchEvent() for total control over when jsincss reprocesses styles.

Example

This example uses the default selector and events list, and provides the stylesheet inline.

<script type=module>
  import jsincss from 'https://unpkg.com/jsincss/index.vanilla.js'

  jsincss(event => `

    body::before {
      content: '${innerWidth} x ${innerHeight} on ${event.type}';
    }

  `)
</script>

It's also possible to write your stylesheets as a separate JavaScript module like this:

export default event => `

  body::before {
    content: '${innerWidth} x ${innerHeight} on ${event.type}';
  }

`

And then import both the jsincss plugin and the stylesheet into your module and run them like this:

import jsincss from 'https://unpkg.com/jsincss/index.vanilla.js'
import stylesheet from './path/to/stylesheet.js'

jsincss(stylesheet)

Tools using jsincss

Compatible JS-in-CSS Plugins

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].