Giter Site home page Giter Site logo

neos21 / in-browser-sass Goto Github PK

View Code? Open in Web Editor NEW
19.0 1.0 5.0 2.33 MB

@neos21/in-browser-sass : Compile SASS / SCSS in the browser.

Home Page: https://neos21.github.io/in-browser-sass/

License: MIT License

JavaScript 57.38% HTML 40.23% Sass 1.40% SCSS 0.98%

in-browser-sass's Introduction

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.

Links

in-browser-sass's People

Contributors

neos21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

in-browser-sass's Issues

Does this handle imports?

I have a scss file that looks similar to this

@import './base';

.foo {
    color: bar;
}

I am getting undefined in my style tag.

MIMETYPE!?

I get this error, whatever I set in "type" (type="text/sass", type="text/scss" or type="text/css"):

The stylesheet http://grid2fullscreen.local/css/style.scss was not loaded because its MIME type, “text/plain”, is not “text/css”.

Sass import not working

Really like this js library, but I have a big SCSS file that I would like to extract into multiple files. I tried to use the import and it seems to error out. Any way around this?

Syntax errors?

I get this as well:

SyntaxError: expected expression, got '&'

from the "in-browser-sass-standalone.min.js" file ...

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.