Я пытаюсь импортировать bootstrap.css
в файл .less
, так что я могу условно применять стили Bootstrap с медиа-запросами.
Вот мой МЕНЬШЕ код:Как использовать стили Bootstrap в файле LESS?
// Visual Studio is saying "Couldn't locate" the file for both, yet they are there:
@import url("bootstrap.min.css");
@import url("bootstrap-theme.min.css");
// ...can't find the source of the "@screen" at-rules:
@extra-small: ~"screen and (max-width: @screen-xs-max)";
@small: ~"screen and (min-width: @screen-sm-min) and (max-width: @screen-sm-max)";
@medium: ~"screen and (min-width: @screen-md-min) and (max-width: @screen-md-max)";
@large: ~"screen and (min-width: @screen-lg-min)";
footer {
text-align: center;
// ...doesn't like the comma "or" syntax here, so "or" is used instead:
@media @extra-small or @small {
#linkedin-flair {
.hide // compile error
}
#stackoverflow-flair {
.hide // compile error
}
}
@media @medium {
#linkedin-flair {
.col-sm-3 // compile error
}
#copyright-text {
.col-sm-6 // compile error
}
#stackoverflow-flair {
.col-sm-3 // compile error
}
}
@media @large {
#linkedin-flair {
.col-sm-4 // compile error
}
#copyright-text {
.col-sm-4 // compile error
}
#stackoverflow-flair {
.col-sm-4 // compile error
}
}
}
... тем меньше возникают проблемы с @import
и @screen
на-правил, а также с привязкой любых классов Bootstrap, таких как .hide
.
Я использую Visual Studio 2013, Web Essentials, 2013 и Bootstrap 3.
Примечание: это был вдохновлен вопрос http://stackoverflow.com/questions/15837808/fancy-media-queries-with-some-less-magic и Bootstrap вещи найдены на странице http://getbootstrap.com/css/#grid-media-queries. –
См. [1] (http://stackoverflow.com/q/20281919/2712740), [2] (http://stackoverflow.com/q/20244996/2712740), [3] (https: // github. com/less/less-docs/blob/master/content/features/import-directives.md) –