Skip to content

Instantly share code, notes, and snippets.

@ForbesLindesay
Last active December 15, 2015 15:18
Show Gist options
  • Save ForbesLindesay/5280494 to your computer and use it in GitHub Desktop.
Save ForbesLindesay/5280494 to your computer and use it in GitHub Desktop.
@import "./fixture.css" screen;
@import "./fixture.css" print;
/* This a fixture to be imported */
.foo {
bar: 'baz';
}

You're challenge, should you choose to accept it, is to inline the following @import statements in CSS. What should the result be. "SyntaxError" is a perfectly acceptable answer. If anyone knows what the current spec does, I'd be interested to know, but I'm equally keen to find out what people think the spec should do.

Please place the results of inlining @import statements in each file (except fixture.css) in the comments. Your help is appreciated, and if I meet you in a bar some time, I owe you a pint.

.bar {
bing: 'bong';
}
@import "./fixture.css";
@media screen {
.bar {
bing: 'bong';
}
@import "./fixture.css";
}
@media screen {
@import "./fixture.css";
}
.bar {
bing: 'bong';
}
@media screen {
@import "./fixture.css";
}
@import "./fixture.css";
@import "./fixture.css";
.bar {
bing: 'bong';
}
@import "./fixture.css";
.bar {
bing: 'bong';
}
@ForbesLindesay
Copy link
Author

I've made some progress. According to MDN, it's a syntax error unless they're at the top of the document (which keeps things nice and simple). @visionmedia has suggested just doing a simple include might be best (i.e. replace @import 'foo'; with the contents of 'foo'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment