Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
minViewport = contextMinViewport
if (argv.minviewport !== undefined) {
minViewport = Math.max(contextMinViewport, argv.minviewport)
}
maxViewport = contextMaxViewport
if (argv.maxviewport !== undefined) {
maxViewport = Math.min(contextMaxViewport, argv.maxviewport)
}
if (argv.verbose) {
console.log(
color.green(
`Viewports will be considered from ${color.white(
minViewport + 'px',
)} to ${color.white(maxViewport + 'px')}`,
),
)
}
/* ======================================================================== */
if (argv.verbose) {
console.log(
color.bgCyan.black(
'\nStep 2: get variations of image width across viewport widths',
),
)
}
const VIEWPORT = {
width: minViewport,
height: 2000,
// throw error to console
log(colors.bold(colors.red(err.name + ': ' + err.message)));
// throw notification
notifier.notify({
title: 'ROARRRRRRRRRR!',
message: 'JavaScript gone wrong.',
sound: 'Basso',
contentImage: __dirname + '/../assets/trex.png'
});
})
.pipe(source('script.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(process.env.APP_ENV === 'production' ? uglify() : through())
.pipe(through((log(colors.white('JS files generated:')))))
.pipe(size({title: 'Scripts:', showFiles: true}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(config.scripts.destinationFolder))
.pipe(browserSync.stream());
}
const task = (done) => {
if (process.env.APP_ENV === 'production') {
console.log(colors.white('\n Production'));
// bring out some ASCII art
asciify('REDAXO', {
font: 'big',
color: 'red'
}, (err, res) => {
console.log(res);
done();
});
}
else {
console.log(colors.white('\n Development'));
// bring out some ASCII art
asciify('BIMMELBAM', {
server.listen(staticport, () => {
const uri = `http://localhost:${staticport}`
const formatting = {
borderColor: `cyan`,
padding: 1,
dimBorder: true
}
const message = color.red(`displays and tools at\n${color.white(uri)}`)
console.log(boxen(message, formatting))
opn(uri).catch()
})
})
log: message => console.log(ansi.white(`[LOG] ${message}`)),
error: message => console.log(ansi.redBright(`[ERROR] ${message}`)),
return;
}
const match = item.negativeMatch
? !item.regex.test(fileContents)
: item.regex.test(fileContents);
if (match) {
results.push(item);
logs.push(' ' + colors.yellow(item.message) + '\n');
}
});
if (logs.length) {
const fileName = colors.white(
'File: ' + colors.underline(path.basename(filePath)) + '\n'
);
logBuffers[logBuffer].push(fileName);
logBuffers[logBuffer] = logBuffers[logBuffer].concat(logs);
}
}
return results;
}
function drawFlag() {
log(colors.white(""));
log(colors.white("* * * * * ========================"));
log(colors.white("* * * * * ========================"));
log(colors.white("* * * * * ========================"));
log(colors.white("* * * * * ========================"));
log(colors.white("=================================="));
log(colors.white("=================================="));
log(colors.white("=================================="));
log(colors.white(""));
}
del(config[v].cleanFiles).then(function (touchedFiles) {
if (touchedFiles.length > 0) {
log(colors.white('Cleaned ' + v + ': ' + colors.magenta(touchedFiles.length)));
}
done();
});
});