Git Product home page Git Product logo

dropin-minimal-css's Introduction

Drop-in switcher for previewing minimal CSS frameworks

This is a quick drop-in CSS switcher to allow for previewing some of the many minimal CSS-only frameworks that are available. See the demo or drop the switcher into your own page to see how different frameworks would look together with your content.

This project only includes minimal frameworks, in other words, boilerplate / classless frameworks that require no adjustment of the corresponding HTML and can be simply dropped into the project to provide a starting point for further design. No additional javascript, compiling, pre-processors, or fiddling with classes should be required for these to look good and be responsive.

Usage

To use the CSS switcher, just add the following line anywhere within the body tag on your page:

<script src="https://dohliam.github.io/dropin-minimal-css/switcher.js" type="text/javascript"></script>

That's it! You should now be able to cycle through the different frameworks by choosing them from the dropdown at the top of the page.

Keyboard shortcut

You can quickly switch between frameworks by pressing the modifier key or keys on your keyboard + s to focus the switcher dropdown menu, followed by the up and down keys to move up and down the list.

Bookmarklet

The bookmarklet is a convenient way to preview how different CSS frameworks would look on any HTML page. Just paste the following code into your address bar to create a CSS switcher for any site:

javascript:(function()%7Bvar%20body%20%3D%20document.getElementsByTagName('body')%5B0%5D%3Bscript%20%3D%20document.createElement('script')%3Bscript.type%3D%20'text%2Fjavascript'%3Bscript.src%3D%20'https%3A%2F%2Fdohliam.github.io%2Fdropin-minimal-css%2Fswitcher.js'%3Bbody.appendChild(script)%7D)()

Or alternatively, drag the link at the top of the demo page to your browser's bookmark bar.

Boomarklet generated by the Bookmarklet Creator. Thanks to markdown-css for the idea!

API

There is a simple API available to allow linking directly to particular stylesheets on the demo page. For example:

https://dohliam.github.io/dropin-minimal-css/?sakura

The above links directly to the demo with Sakura CSS.

Frameworks

Adding frameworks

If you know of a minimal framework that hasn't been included here, please create an issue or pull request so that we can add it to the list!

List of frameworks

Theme collections

See also

  • workflow - Quick prototyping script for creating rich html and pdfs from markdown documents (based on dropin-minimal-css)
  • asciidoctor-skins - CSS stylesheets for asciidoctor (with a switcher based on dropin-minimal-css)

Other similar collections

Acknowledgements

License

MIT.

dropin-minimal-css's People

Contributors

blainsmith avatar bryancasler avatar cito avatar dohliam avatar evgenyorekhov avatar faraixyz avatar kimeiga avatar michaelsmanley avatar nickali avatar ruanmartinelli avatar sobolevn avatar thelastzombie 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dropin-minimal-css's Issues

Auto-update CSS

CSS frameoworks should be automatically updated at regular intervals. This should address issues like #14 as well as the many other frameworks that have outdated information listed. Related tasks:

  • Basic information about each framework, including license links and author information etc should be stored in a YAML file that serves as the source of truth for the project. Updates to file locations, author names, project names etc should be made directly to the data file, and a script should use the file to check for updates, download CSS sources, and minify them.
  • The js switcher and readme file should also be auto generated at the same time.
  • Unminified source files should be stored in a src folder to allow for inspection of code and easier diffing between versions
  • Minified files should be stored in min folder for use by ghpages site

Wrong author for papier

papier is listed with @baasdesign as the author. Unless I'm missing something obvious, I don't think that's correct. Think it should be @alexanderGugel.

Template should have nested lists

Please included nested lists in the template.

  <li>Top level
    <ul>
      <li>Inside</li>
    </ul>
  </li>

Some frameworks are not handling that properly. So preview will help.

Failed to find a valid digest in the 'integrity' attribute

Steps to reproduce:

  1. Go to https://evgenyorekhov.github.io/holiday.css/src/index.html
  2. Click on the Drop-in bookmarklet
  3. Select a different CSS framework from the Drop-in switcher

Expected result: selected framework's styles should be applied to the page

Actual result: styles are not applied, there is the following error in the browser console

Failed to find a valid digest in the 'integrity' attribute for resource
'https://dohliam.github.io/dropin-minimal-css/min/awsm.min.css'
with computed SHA-256 integrity
'giTWrXju6B1GUPSb1nHYBfCZzd73kLweWPjVOBzNxAA='.
The resource has been blocked.

image

API

There should be a simple API to allow for directly linking to a particular stylesheet. For example:

https://dohliam.github.io/dropin-minimal-css/?sakura

The above should link directly to the demo with Sakura CSS. This should also enable selecting a particular default CSS stylesheet for the bookmarklet.

Include instructions for contributing new frameworks

It should be much easier to include new frameworks now, since all that is required is to add the relevant information to frameworks.yml and the repo will update itself automatically. Step-by-step instructions on how to do this probably be helpful for new contributors though. These should be included in a CONTRIBUTING.md file and linked from the main readme.

This should include information about adding new frameworks vs. adding new collections of frameworks (or expanding an existing collection).

Remove Bulma and Tachyons

After the latest updates, Bulma and Tachyons no longer seem to be usable as classless/minimal stylesheets, so they should probably be removed. Alternatively, we could link to older versions of the CSS, but that might be misleading for users wanting to use them in other projects.

Cruise control...

Please allow me to switch through the options just by pressing up and down on the arrow keys

Remove Shoelace

The latest version of Shoelace has removed the compiled CSS and is no longer really usable as a minimal "dropin" stylesheet. The legacy version has been linked for now, but it should probably be removed eventually from the list.

Replace audio example

Since ccMixter inexplicably does not yet support SSL, the demo page gives a warning about loading mixed content (this might even prevent loading on some strict browsers / configurations). The ccMixter link should therefore be replaced with a different freely-licensed audio sample.

new css switcher

Hi 👋

I tough that the added dropdown (<select>) where too intrusive or out of place and not really that keyboard friendly.
the page was jumping a lot between switching teams and the dropdown select was changing a lot.

so i tried to go ahead and create a non intrusive selector in a new popup window using <select multiple> 😜
yea that old school dropdown! it have better keyboard navigation cuz it's inlined and you don't need to open up the dropdown every time. and you can move this popup around.

even created a tiny little auto switcher to change theme every x sec

const hybrid = 'bamboo basic bolt brutalist centigram concrete holiday missing-style mvp new neat ok pico simple spcss superstylin vanilla yamb'
.split(/\s+/).sort()
const solid = 'a11yana axist bahunya almond bare base bonsai bullframe caramel caiuss centurion chota cardinal classless clmaterial codify comet concise cutestrap flat-ui bulma fluidity furtive generic gd github-markdown gutenberg hack hello html-starterkit hyp kathamo koochak kraken kube lemon lit lotus hiq markdown marx cirrus mercury min milligram mini minimal minimal-stylesheet mobi motherplate mu mui no-class normalize oh-my-css pandoc-scholar paper papier pavilion picnic preface roble pure sakura sanitize materialize propeller material primer latex scooter semantic-ui shoelace siimple skeleton skeleton-framework skeleton-plus snack spectre style stylize tacit tent terminal tui vital water tachyons wing writ yorha thao ads-medium ads-notebook ads-tufte attri-bright-light-green attri-midnight-green attri-dark-forest-green attri-dark-fairy-pink attri-light-fairy-pink awsm-default awsm-black awsm-bigstone awsm-gondola awsm-mischka awsm-pastelpink awsm-pearllusta awsm-tasman awsm-white md-air md-modest md-retro md-splendor w3c-chocolate boot-readable boot-cosmo boot-cyborg boot-darkly boot-journal boot-paper w3c-midnight w3c-modernist w3c-oldstyle boot-cerulean boot-flatly boot-lumen boot-sandstone boot-slate boot-spacelab boot-superhero boot-yeti w3c-steely w3c-swiss w3c-traditional w3c-ultramarine ads-gazette'
.split(/\s+/).sort()
const responsive = []
// .split(/\s+/).sort()

const all = [...new Set([...hybrid, ...solid])].sort()

const $$ = (tag, attr) => Object.assign(document.createElement(tag), attr)
const $ = (tag, attr) => Object.assign(document.createElement(tag), attr)

// get window size / position from css-switcher
const pos = localStorage.getItem('css-switcher')
const [x, y, w, h] = pos?.split(',') || [0, 0, 200, 200]

const popup = open('about:blank', 'css-switcher', `left=${x},top=${y},width=${w},height=${h}`)

popup?.document.head.append($$('meta', {
  name: 'color-scheme',
  content: 'dark light'
}))

popup.document.title = 'css-switcher'

// this dummy template literal function like provide good IDE support with syntax highlighting
// in many cases, guess we have Lit.js to thanks for this. (?)
const html = x => x.join('')

popup.document.body.innerHTML = html`
  <style>
    /* set html & body to 100% width and height */
    /* and set the body to display items as grid */
    /* where the 2nd div is as tight as possible */
    html, body {
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
    }
    body {
      font-family: system-ui;
      box-sizing: border-box;
      display: grid;
      grid-template-rows: 1fr auto;
      grid-template-columns: 1fr;
      grid-template-areas: "select" "footer";
    }
    select {
      padding: 20px;
      margin: 0;
      border: 0;
      outline: 0;
      width: 100%;
      height: 100%;
    }
    p {
      text-align: center;
    }
  </style>
  <select autofocus multiple>
    <optgroup id="hybrid" label="Supports prefer-color"></optgroup>
    <optgroup id="responsive" label="Responsive -ness">
      <option value="TODO" disabled>(TODO)</option>
    </optgroup>
    <optgroup id="all" label="All styles"></optgroup>
  </select>
  <p>
    AutoSwitch every <input type="number" id="seconds" value="" placeholder="10s" min="0" max="999" step="1" autofocus>
  </p>
`

const select = popup.document.querySelector('select')
const sHybrid = select.querySelector('#hybrid')
const sResponsive = select.querySelector('#responsive')
const sAll = select.querySelector('#all')

// Disable all other stylesheets on the page
for (const style of Array.from(document.styleSheets)) {
  style.disabled = true
}

const link = document.createElement('link')
link.rel = 'stylesheet'
document.head.append(link)
function changeCSS (css) {
  link.href = `https://dohliam.github.io/dropin-minimal-css/min/${css}.min.css`
}

const capitalize = s => s.replace(/^(.)/, (_, l) => l.toUpperCase())

// Add all stylesheets to the first multiselect
for (const css of hybrid) {
  const option = $$('option', { value: css, label: capitalize(css) })
  sHybrid.append(option)
}

for (const css of responsive) {
  const option = $$('option', { value: css, label: capitalize(css) })
  sResponsive.append(option)
}

for (const css of all) {
  const option = $$('option', { value: css, label: capitalize(css) })
  sAll.append(option)
}

// select the first option
changeCSS(select.value = select.options[0].value)

// Store the windows position/size in local storage so it can be restored
// on subsequent visits when the popup is resized or moved
popup.onresize = 
popup.onunload = 
popup.onmove = () => {
  localStorage.setItem('css-switcher', [
    popup.screenX,
    popup.screenY,
    popup.outerWidth,
    popup.outerHeight
  ].join(','))
}

// Close the popup when either window or popup is closed or reloaded
popup?.addEventListener('unload', () => popup.close())
addEventListener('unload', () => popup.close())

select.onchange = () => {
  const css = Array.from(select.selectedOptions).map(o => o.value)
  // if only one option is selected, change the css
  if (css.length === 1) {
    changeCSS(css[0])
  }
}

// AutoSwitch every X seconds
const autoSwitch = popup.document.querySelector('#seconds')
let interval = 0

autoSwitch.oninput = () => {
  clearInterval(interval)
  if (!autoSwitch.value) return
  
  interval = setInterval(() => {
    select.selectedIndex += 1
    if (select.selectedIndex === -1) {
      select.selectedIndex = 0
    }
    select.onchange()
  }, autoSwitch.value * 1000)
}

(it's not the fanciest javascript code i have ever created, it was just something i quickly put togheter)

anyhow it's using strict syntax, and so there is no undefined variabels anywhere now in this so the bookmarklet script can be done easier: now you just need to have javascript:import('https://dohliam.github.io/dropin-minimal-css/switcher.jsl')


I wanted the css to be kind of categorized by those who support prefer color and can satisfy ppl like me who prefer dark mode

and then i also saw that someone asked for those who are response also ( #40 ) so i added a category for them two in the optgroup (but it's empty atm)

Latex CSS

We currently include LatexCSS (69 stars). There is also a separate project called LaTeX.css (1.2k stars). Output is similar, with some differences, most notably the size of the headings. Both appear to be actively maintained. Options:

  • Include both (but find some way to distinguish them -- is capitalization enough? e.g., Latex CSS vs. LaTeX CSS)
  • Choose one of them to include (perhaps the more active/popular one?)

Rename frameworks

  • sanitize-zdroid should be renamed to codify
  • sanitize-10up should be renamed to sanitize

Add W3C Core Styles

This W3C Core Styles are a collection of CSS stylesheets that have been made available by the W3C for more than two decades:

The W3C Core Styles offer authors an easy way to start using style sheets without becoming designers. By adding a link in the head of your documents, a CSS browser will fetch the style sheet of your choice from W3C's server when it encounters your document. A non-CSS browser will display the HTML document like it always did.

Included styles:

Add reference to responsivness

I might or might not have scrolled through the entirety of the list to check whether the stylesheets are responsive or not.
Foolishly, I only noted for a few of them the result of my check.

Is there any smarter way to add a mention of whether a stylesheet is responsive or not? Maybe add a (Responsive) next to the ones that are?

Horizontal scroll

I don't know if this is the right place to ask, sorry if not.

Most frameworks present horizontal scroll on mobile, which is annoying from a responsiveness perspective, including some that claim to be responsive. Is it because of this particular demo implementation or they aren't really as responsive as they claim to be?

Add YAMB css

Hey there! :)

I'd like to see YAMB css included.
Thanks in advance!

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.