const prodScss = () => () => {
return gulp.src(config.srcPath + config.scss + '/main.scss')
.pipe(sass())
.pipe(autoprefixer({
browsers: ["last 15 versions"],
cascade: true
}))
.pipe(gcmq())
.pipe(cleanCSS({compatibility: "ie8"}))
.pipe(gulp.dest(config.prodPath + config.css));
};
git push --set-upstream origin develop
const devScss = (browserSync) => () => {
return gulp.src(config.srcPath + config.scss + '/main.scss')
.pipe(sourcemaps.init())
.pipe(plumber())
.pipe(sass().on("error", sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest(config.devPath + config.css))
.pipe(browserSync.stream());
}
import * as React from 'react';
import { Link } from 'react-router-dom';
import styled, { css } from 'styled-components';
const baseStyles = css`
display: inline-flex;
align-items: center;
font-family: ${props => props.theme.sanSerifFamily};
font-size: 15px;
cursor: pointer;
outline: none;
user-select: none;
&:disabled {
cursor: not-allowed;
pointer-events: none;
}
`;
const getButtonSizeStyles = ({ size }) => {
switch(size) {
case 'sm':
return css``;
case 'md':
return css`
height: 32px;
line-height: 32px;
padding: 0 16px;
border-radius: 3px;
`;
case 'lg':
return css`
height: 40px;
line-height: 40px;
padding: 0 30px;
font-weight: 500;
border-radius: 5px;
`;
}
};
const getButtonStyles = ({ type }) => {
switch (type) {
case 'outline':
return css`
${getButtonSizeStyles};
color: #0082ea;
background-color: #fff;
border: 1px solid currentColor;
&:hover {
color: #006CB5;
}
`;
default:
return css`
${getButtonSizeStyles};
color: #fff;
background-color: #0082ea;
border: 1px solid #0082ea;
&:hover {
background-color: #006CB5;
}
&:disabled {
background-color: #ccc;
border-color: #ccc;
}
`;
}
};
const getComponent = styledFunction => styledFunction`
${baseStyles}
${getButtonStyles}
`;
type ButtonSize = 'sm' | 'md' | 'lg';
type Props = {
children: any
type?: string
onClick?: Function
to?: string
className?: string
disabled?: boolean
size?: ButtonSize
}
function Button({
type,
className,
to,
onClick,
children,
disabled,
size = 'md',
...props
}: Props) {
const styledFunction = to ? styled(Link) : styled.button;
const Component = getComponent(styledFunction);
return (
<Component
type={type}
size={size}
className={className}
disabled={disabled}
to={to}
onClick={onClick}
{...props}
>
{children}
</Component>
);
}
export default Button;
const gulp = require("gulp");
const createJSTask = require('./tasks/js');
const createNunjucksTask = require('./tasks/nunjucks');
const browserSync = require("browser-sync");
const browserSyncInstance = browserSync.create();
gulp.task('js', createJSTask(browserSyncInstance));
gulp.task('nunjucks', createNunjucksTask(browserSyncInstance));
const complexMixin = css`
color: ${props => props.whiteColor ? 'white' : 'black'}
`;
const StyledComp = styled.div`
${props => props.complex ? complexMixin : 'color: blue;'}
`;
<video id="video-player"></video>
var videoPlayer = document.getElementById("video-player");
const reducer1 = (state, action) => {
switch (action.type) {
case 'action':
return {data: 'new state' };
default:
return state;
}
}
const reducer2 = (state, action) => {
switch (action.type) {
case 'action':
return {data: 'new state' };
default:
return state;
}
}
store.dispatch({ type: 'action' });
как вы предлагаете обрабатывать код который я привел выше ?
функция для присваивания красного цвета элементам. Может принимать как объект так и массив объектов. А зачем плодить повторяющийся код ?
if (data instanceof HTMLCollection || data instanceof NodeList) {
// итерация коллекции
} else {
// работа с элементом
}
. Все что мне нужно это отделить объекты которые можно обрабатывать циклом
А вы с какой целью интересуетесь? Возникло желание его нарушить?
Лучше не связывайтесь, всю жизнь потом расплачиваться можете если проект серьезный, а от ваших действий компания понесет убытки.