GithubHelp home page GithubHelp logo

jackw / eyeglass-image-dimensions Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 47 KB

An eyeglass module giving node-sass the same image dimension functionality found in ruby compass.

License: Apache License 2.0

JavaScript 95.89% CSS 4.11%
sass eyeglass images image-dimensions eyeglass-image-dimensions node-sass

eyeglass-image-dimensions's Introduction

Build Status NPM Downloads devDependency Status

eyeglass-image-dimensions

An eyeglass module to give node-sass the same image dimension functionality found in ruby compass.

Setup

To use image dimensions first install eyeglass then eyeglass-image-dimensions:

npm install eyeglass eyeglass-image-dimensions --save-dev

Then add the following to your sass file/s:

@import 'image-dimensions';

Usage

image-width

returns the width of the image in pixels.

width: image-width($image);

image-height

returns the height of the image in pixels.

height: image-height($image);

image-dimensions

returns a space separated list consisting of the width and height of an image in pixels.

background-size: image-dimensions($image);

eyeglass-image-dimensions's People

Contributors

jackw avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eyeglass-image-dimensions's Issues

Consider using ">=0.8.0" for eyeglass "needs"

Hi,

I'm getting this messages when I compile my SASS files:

The following modules are incompatible with eyeglass 1.2.1:
  image-dimensions needed eyeglass ^0.8.0

Is it possible to change the compatibility line to "needs": ">=0.8.0" ?

As mentioned in sass-breakpoint issue #174:

It maintains current compatibility and future proofs against 1.x releases of eyeglass.

Joanna's feedback

In eyeglass-exports.js line 47, there's no need to loop through each module's assets to get the filepath. Since asset is a map, a map lookup using asset.coerce.get(file) should get the necessary information.

eg-image-width and eg-image-height should each return a Sass number rather than a string. This can be done using sassUtils.castToSass.

eg-image-dimensions should return a space-delimited Sass list. This can be done by calling sassUtils.castToSass on a 2-element array of SassDimensions with the separator set to false.

The convention we've been using is to import eyeglass modules without the eyeglass- prefix. This would just require adding an eyeglass field to package.json and setting the name to image-dimensions.

If the user passes in a real file path rather than an asset path, we should check that it's an absolute rather than a relative file path.

Update the readme to include image-dimensions.

Let's add some tests for the module.

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.