Skip to content

harvesthq/sass-inline-image

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sass-inline-image

npm i sass-inline-image

Use the inline-image function from Compass in node-sass.

Examples

gulp

// in gulpfile
var gulp = require('gulp');
var sass = require('gulp-sass');
var sassInlineImage = require('sass-inline-image');
gulp.src('style.scss')
    .pipe(
        sass({
            functions: sassInlineImage({ /* options */ })
        })
    )
    .pipe(gulp.dest('./css'));
body {
    background: inline-image('path/to/image.png');
}

ember-cli

// In ember-cli-build.js
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var sassInlineImage = require('sass-inline-image');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    // Add options here
    sassOptions: {
      functions: sassInlineImage({ base: 'public/assets/images' })
    }
  });

  return app.toTree();
};
body {
    background: inline-image('path/to/figure.svg');
}

Credit

Credit to Sergii Iavorskyi at coderwall.

Credit to Joseph Clay for the original implementation.

License

See license.md.

About

Base64 inline images in gulp-sass

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%