npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@twbs-css/template-literals

v2.0.1

Published

Bootstrap CSS as template & tagged literals

Downloads

9

Readme

template-literals

The purpose of this node library is to provide an easy and maintainable way to use existing bootstrap customization tools and generate css exported as string and tagged literals that can easily be integrated into web components.

Versioning

| Bootstrap | Library versions | |-------------|--------------------| | v5.2.x | v1.0.x | | v5.3.x | v2.0.x |

Installation

Install via npm:

npm install @twbs-css/template-literals

Import

Example of importing bootstrap root css as template literal:

import {HostCssTemplateLiteral} from '@twbs-css/template-literals';

Example of importing bootstrap root css as Lit tagged template literal:

import {HostCssTaggedTemplate} from '@twbs-css/template-literals';

Use case

Main use case is to allow easier css for web components (with string literals) and for Lit elements components (with tagged templates).

Example using the string literals in plain web components:

const template = document.createElement('template');
template.innerHTML = `
<style>
    ${HostCssTemplateLiteral}
</style>
<<add rest of html template>>`;

Example using the tagged template literals in Lit element components:

static get styles() {
    return [
        HostCssTaggedTemplate
    ];
}

Bootstrap CSS Layout template literal

The files grid.literal.css.js and its tagged version grid.tagged.css.js are using the default and well-known bootstrap grid system with the default settings. However, since bootstrap v5.1.0 it provides an experimental grid system which is based on CSS grid specification instead. To use this grid system instead of the default one you can use files grid-layout.literal.css.js or its tagged grid-layout.tagged.css.js

Generate bootstrap template literals with different sass variables

After cloning this branch you can:

  • Add your variables to one of the existing scss files under src/scss or
  • Add a new scss file under src/scss and your logic
    • Edit bootstrap-items.js to add the details so that the generator will know where to pick up the new file

After you are done with the changes, execute npm run build and the generated files are under /dist.

Notes:

  • Bootstrap root css will not work in case of web components since :root is only applicable to document.
  • You can use the HostCssTemplateLiteral or HostCssTaggedTemplate which is the same as root but will work for web components under shadow dom.
  • Type css does not include the entire reboot css so in case you use both reboot and type just make sure type is the last item, so it can override rules.
  • Reboot css includes both :root as well as :host media query for prefers-reduced-motion