I want to generate various css files such as:
- global.css
- mobile.css
- tablet.css
- desktop.css
- mobile-forum.css
- table-forum.css
and etc. I have such HTML code:
<link rel="stylesheet" media="all and (max-width: 450px)" href="assets/css/mobile.css">
<link rel="stylesheet" media="all and (min-width: 450px) and (max-width: 1024px)" href="assets/css/tablet.css">
<link rel="stylesheet" media="all and (min-width: 1024px) and (max-width: 1264px)" href="assets/css/desktop.css">
<link rel="stylesheet" media="all and (min-width: 1264px)" href="assets/css/widescreen.css">
So i created each *.scss with such content:
in desktop.scss
$mode: "desktop";
@import "main";
in _main.scss i created such variable:
$desktop: false;
@if $mode == 'desktop' {
$desktop: true;
}
So the problem is such. I whant to use _normilize.scss
@if $global {
@import "parts/normalize";
}
But i have error here:
Syntax error: Import directives may not be used within control directives or mixins.
on line 3 of /opt/code/host/resulinkpro/design/assets/sass/_main.scss
Compiling using compass watch
And my question are:
- Can i make that work (other version of SCSS or COMPASS)?
- If not can be any alternatives? The main idea contain logic in _main.scss and nested files, not in global.scss or mobile.scss (i just enable a mode there and nothing more)
- Or LESS will be better for such task?
My main idea is to avoid unwanted media-queries, in this making .css smaller and then using javascript replace mode (currently using media attribute in tag). Also use only necessary styles in browser.