@neos21/in-browser-sass

1.0.10 • Public • Published

in-browser-sass : @neos21/in-browser-sass

NPM Version GPR Version

Compile SASS / SCSS in the browser.

Japanese version is here

Demo

Demo (GitHub Pages)

Installation

<!-- Load sass.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sass.js/0.11.1/sass.sync.min.js"></script>
<!-- Load this script -->
<script src="in-browser-sass.js"></script>

sass.js CDNs are available here:

Bundle Version

Bundle version includes sass.js. So installation needs one line:

<!-- Load this script included sass.js -->
<script src="in-browser-sass.bundle.js"></script>

Usage

You can use link or style elements for include SASS / SCSS. type="text/sass" or type="text/sass" attribute must be set.

<!-- SASS : link tag -->
<link rel="stylesheet" type="text/sass" href="example.sass">

<!-- SCSS : link tag -->
<link rel="stylesheet" type="text/scss" href="example.scss">

<!-- SASS : style tag -->
<style type="text/sass">
body
  p
    color: #f00
</style>

<!-- SCSS : style tag -->
<style type="text/scss">
body {
  p {
    font-weight: bold;
  }
}
</style>

This compiles to:

<!-- SASS : link tag -->
<link rel="stylesheet" type="text/sass" href="example.sass">
<!-- Compiled example.sass -->
<style type="text/css">
body > selection {
  font-size: 110%;
}
</style>

<!-- SCSS : link tag -->
<link rel="stylesheet" type="text/scss" href="example.scss">
<!-- Compiled example.scss -->
<style type="text/css">
a {
  color: #06f;
}
a:hover {
  color: #f09;
}
</style>

<!-- SASS : style tag -->
<style type="text/sass">
body
  p
    color: #f00
</style>
<!-- Compiled inline SASS -->
<style type="text/css">
body p {
  color: #ff0;
}
</style>

<!-- SCSS : style tag -->
<style type="text/scss">
body {
  p {
    font-weight: bold;
  }
}
</style>
<!-- Compiled inline SCSS -->
<style type="text/css">
body p {
  font-weight: bold;
}
</style>

Compiled style elements are inserted after each original element.

@import is not supported.

Author

Neo

Links

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i @neos21/in-browser-sass

    Weekly Downloads

    51

    Version

    1.0.10

    License

    MIT

    Unpacked Size

    18.3 MB

    Total Files

    16

    Last publish

    Collaborators

    • neos21