$h1: 30px;
h1 { font-size: $h1; }
@media(){
$h1: 20px;
}
$h1: 30px;
$h1-sm: 20px;
h1 { font-size: $h1; }
@media(){
h1 { font-size: $h1-sm; }
}
:root {
--h1: 30px;
}
h1 { font-size: var(--h1, 30px); }
@media(){
:root {
--h1: 20px;
}
}
$size: 36px;
border-radius: calc(#{($size/2) / $size});
$size: 36px;
$result: ($size/2) / $size;
border-radius: calc(#{$result});
$size: 36px;
border-radius: calc((#{$size}/2) / #{$size});
$size: 36px;
border-radius: (($size/2) / $size);
$color-black: #000;
:root {
--color-black: #{$color-black}
}
.class {
color: $color-black; // fallback
color: var(--color-black);
}
src: url('../fonts/FiraSans-Regular/FiraSans-Regular.woff') format('woff');
src: url('../fonts/FiraSans-Regular/FiraSans-Regular.svg') format('svg');
src: url('../fonts/FiraSans-Regular/FiraSans-Regular.woff') format('woff'),
url('../fonts/FiraSans-Regular/FiraSans-Regular.svg') format('svg');
opechatka
.soc {
}
opechatka .soc {
}
{
opechatka
display: flex;
}
{
opechatka: 10px;
display: flex;
}
Вложенных массивов же Sass не знает? В доке не нашёл.
$text_sizes: (
s: ( s:20px, m:48px, l:100px ),
m: ( s:24px, m:56px, l:114px ),
l: ( s:28px, m:68px, l:138px ),
xl: ( s:32px, m:74px, l:154px ),
xxl: ( s:36px, m:88px, l:184px ),
);
@each $size, $def in $text_sizes {
.text_size_#{$size} {
@each $word_size, $word_width in $def {
.text__word_width_#{$word_size} {
width: $word_width;
}
}
}
}
.menu {
position: relative;
&__item {
display: block;
margin-bottom: 5px;
position: relative;
}
&__link {
display: block;
font-size: 1rem;
color: blue;
}
&__img {
position: absolute;
width: 10px;
height: 10px;
display: none;
}
//==
//== Hover & active states
//== ======================================= ==//
&__link:hover,
&__link_active {
color: red;
}
&__link:hover + &__img,
&__link_active + &__img {
display block;
}
}
{
"name": "mysite.local",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"dependencies": {
"bs-grid-system": "^2.0.3",
"jquery": "^3.3.1",
"normalize.css": "^8.0.1",
"tiny-slider": "^2.9.0",
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"browser-sync": "^2.26.3",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^6.0.0",
"gulp-babel": "^8.0.0",
"gulp-changed-in-place": "^2.3.0",
"gulp-concat": "^2.6.1",
"gulp-plumber": "^1.2.1",
"gulp-sass": "^4.0.2",
"gulp-sequence": "^1.0.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-twig": "^1.2.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "delphinpro <delphinpro@yandex.ru>",
"license": "MIT"
}
const gulp = require('gulp');
const sass = require('gulp-sass');
const twig = require('gulp-twig');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const plumber = require('gulp-plumber');
const sequence = require('gulp-sequence');
const sourcemaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
const changed = require('gulp-changed-in-place');
const bs = require('browser-sync').create();
gulp.task('sass', function () {
return gulp.src([
'./node_modules/normalize.css/normalize.css',
'./node_modules/tiny-slider/dist/tiny-slider.css',
'./src/sass/**/*.scss',
])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'nested' }))
.pipe(autoprefixer())
.pipe(concat('main.css'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./public_html/design/'))
.pipe(bs.stream())
;
});
gulp.task('js:vendor', function (done) {
gulp.src([
'./node_modules/jquery/dist/jquery.min.js',
'./node_modules/whatwg-fetch/dist/fetch.umd.js',
'./node_modules/tiny-slider/dist/min/tiny-slider.js',
])
.pipe(plumber())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(concat('vendor.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./public_html/design/'))
.on('end', done)
;
});
gulp.task('js', function (done) {
gulp.src([
'./src/js/main.js',
'./src/js/**/*.js',
])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(concat('main.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./public_html/design/'))
.on('end', function () {
bs.reload();
done();
})
;
});
gulp.task('twig', function (done) {
gulp.src([
'./src/twig/*.twig',
])
.pipe(plumber())
.pipe(twig({
base: [__dirname],
}))
.pipe(changed({ firstPass: true }))
.pipe(gulp.dest('./public_html/'))
.on('end', function () {
bs.reload();
done();
})
;
});
gulp.task('serve', function () {
bs.init({
ui: false,
//proxy: 'mysite.local',
server : './public_html',
browser: ['chrome'],
});
// gulp.watch('./public_html/*.html').on('change', bs.reload);
gulp.watch('./src/sass/**/*.scss', ['sass']);
gulp.watch('./src/js/**/*.js', ['js']);
gulp.watch('./src/twig/**/*.twig', ['twig']);
});
gulp.task('default', sequence(['twig', 'sass', 'js', 'js:vendor'], 'serve'));