const filteredArr = arr.filter(elem => Array.isArray(elem) && elem.length);
.item {
$value_1: 50px;
@media only screen and (max-width: 200px) {
width: 100px;
}
width: $value_1;
height: 50px;
background-color: red;
}
.item {
--value-1: 50px;
width: var(--value-1);
height: 50px;
background-color: red;
}
@media only screen and (max-width: 200px) {
.item {
--value-1: 100px;
}
}
let handler = {
apply: function (target, thisArg, args) {
console.log(`this=${thisArg}`); // obj
console.log(thisArg === obj); // true
console.log(this); // Proxy
}
};
let obj = {
p: new Proxy(target, handler)
};
obj.p(1, 2);
text-decoration: underline
. const gulp = require('gulp');
function compress() {
// compress task
}
function watch() {
gulp.watch('src/img/*', compress);
}
function css() {
return gulp
.src('src/scss/*.scss')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass())
.on('error', sass.logError)
.pipe(cleanCSS())
.pipe(
autoprefixer({
browsers: ['last 2 versions'],
cascade: false
})
)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/css'))
.pipe(browserSync.stream());
}
module.exports.default = gulp.series(watch); // ну если один таск можно и просто `watch`.
module.exports.watch = watch;
module.exports.css = css;
module.exports = async function() {
const exportFunctions = {};
// код
// добавляем функции нужные
exportFunctions.sheet = sheet;
return exportFunctions;
};
// другой файл
const mod = require('./test.js').then(funcs => console.log(funcs)); // наши функции
let selectPlatforms = document.querySelector('#select-platforms');
let inputsContainer = document.querySelector('#inputs');
selectPlatforms.addEventListener('change', renderInputs);
function renderInputs() {
inputsContainer.innerHTML = '';
for(let i = 0; i < selectPlatforms.options.length; i++) {
let option = selectPlatforms.options[i];
if(option.selected) {
inputsContainer.insertAdjacentHTML('beforeend', createInput(option.text, option.value));
}
}
}
function createInput(text, name) {
return `<div class="classX">${text} <input type="text" value="" name="<b>${name}</b>"></div>`;
}
renderInputs();
let o = {
x : 2,
y : o.x,
}