SSugarFeature

This feature allows you to apply some "nice to have" features like having a "scrolled" class applied on the body when the user has scroll in the page or having access to a --vh css variable that represent the exact viewport innerHeight and avoid having issues with mobile different viewport height values. Note that if you use the sPostcssSugarPlugin postcss plugin, you can use the vh unit as normal and if will automatically take the value of the --vh variable if it exists. More feature can be added in the future depending on the needs.

Platform  
js
   â”‚    Support  
Chromium supported
Firefox supported
Safari supported
Edge supported
Since  2.0.0
   â”‚   
Olivier Bossel
Olivier Bossel
   â”‚   
beta

  Preview

Simple usage

Simply add the s-sugar property on your body tag

 

Loading code example. Please wait...

  Features

  • Support for "pleasant css" syntax like "s-btn:outline"

  • Polyfill for container queries if needed

  • scrolled class applied on the body when the user has scrolled the page

  • Access to a --vh css variable that represent the exact viewport innerHeight and avoid having issues with mobile different viewport height values

  • Clear all transitions and animations on all the page during a window resize. Helps for performances and cleaner for user

  • Additional input attributes like empty, dirty and has-value

  • Add state attributes to links like actual and actual-child depending on the document location url

  • Prevent the scroll restoration behavior on chrome that can usually be anoying

  • Remove some classes at page loading end: "initial-loading", "loading"

  • Proxy the history.pushState method to make it dispatch an "pushstate" event with the actual state as detail

  Import

  Install

  Interface

  1. pleasantCss
    true
    Boolean

    Specify if you want the "pleasant css" syntax in your pages

  2. containerQuery
    true
    Boolean

    Specify if you want support for container queries in your css or not

  3. scrolled
    true
    Boolean

    Specify if you want the scrolled class to be applied on the body element when the page has been scrolled

  4. scrolledDelta
    200
    Number

    Specify after how many scroll the scrolled class will be applied

  5. vhvar
    true
    Boolean

    Specify if you want the --vh css variable to be computed and available

  6. inputAdditionalAttributes
    true
    Boolean

    Specify if you want to have the additional attributes on inputs like "has-value", "empty" and "dirty" or not

  7. resizeTransmations
    true
    Boolean

    Specify if you want all the transitions and animations cleared during window resize

  8. linksStateAttributes
    true
    Boolean

    Specify if you want to have the state attributes on links like "actual" and "actual-child" or not

  9. preventScrollRestoration
    true
    Boolean

    Specify if you want to prevent the scroll restoration behavior on chrome that can usually be anoying

  10. env
    true
    Boolean

    Specify if you want to display the current environment at start

Bugs
are not our friends...

Don't hesitate to declare an issue if something does not works as expected.

Declare my issue on Github Talk about it on Discord

The more we are,
the stronger we become.

Don't hesitate to tell some words to you friends about us. The goal is to became more and more each days to help each others...

Support us on Patreon! Share on Facebook! Make a tweet!

The more we are,
the stronger we become.

Don't be afraid to join us on Discord.

Join us on discord!

We love,
Open source!

All of our codebase can be found on Github. We hope that you may contribute to help us make our tools even better!

Discover our codebase!

Welcome on