Financial-Times / o-grid

Responsive grid system
http://registry.origami.ft.com/components/o-grid
94 stars 17 forks source link

JS getCurrentLayout() always returns an empty string #92

Closed callumlocke closed 9 years ago

callumlocke commented 9 years ago
var oGrid = require('o-grid');

window.addEventListener('resize', function () {
  console.log(oGrid.getCurrentLayout());
});

If I use the above code and resize the window, it just logs an empty string over and over.

JakeChampion commented 9 years ago

@callumlocke Are you including the css in the page? Here's an example using the build service - http://jsbin.com/fugiwabebu/edit?html,js,console,output If you remove the link tag from the html and resize the output window, the console will log empty strings.

callumlocke commented 9 years ago

I'm using the Sass mixins. I didn't expect that the JS would depend on CSS. Could we add that to the readme? On Thu, 16 Jul 2015 at 08:33, Jake Champion notifications@github.com wrote:

@callumlocke https://github.com/callumlocke Are you including the css in the page? Here's an example using the build service - http://jsbin.com/fugiwabebu/edit?html,js,console,output If you remove the link tag from the html and resize the output window, the console will log empty strings.

— Reply to this email directly or view it on GitHub https://github.com/Financial-Times/o-grid/issues/92#issuecomment-121860569 .

kaelig commented 9 years ago

Advanced features and edge cases for Sass usage aren't always detailed in the docs. In that case, I'd look at:

https://github.com/Financial-Times/o-grid#adding-a-layout and main.scss at line 50: https://github.com/Financial-Times/o-grid/blob/master/main.scss#L50

Does this help?

If not, feel free to file a PR detailing usage for your use case.

callumlocke commented 9 years ago

Added note in readme to mention this. (Intended to PR but accidentally committed it directly – please revert if not OK!)