GithubHelp home page GithubHelp logo

aarongeorge / frontend-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 0.0 1.32 MB

A frontend boilerplate using Browserify, Gulp, SASS and Vanilla JS.

JavaScript 21.26% HTML 6.01% CSS 53.61% TypeScript 19.12%

frontend-boilerplate's People

Contributors

aarongeorge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

frontend-boilerplate's Issues

Added error console log

`/**

  • Gulpfile
    */

// Dependencies
const gulp = require('gulp');
const browserSync = require('browser-sync').create();

// Set the default environment
gulp.environment = 'local';

// Paths
const paths = {
'src': {
'images': './src/img/',
'root': './src/',
'scripts': './src/js/',
'styles': './src/scss/',
'fonts': './src/fonts/'
},
'webroot': {
'images': './webroot/img/',
'root': './webroot/',
'scripts': './webroot/js/',
'styles': './webroot/css/',
'fonts': './webroot/fonts/'
}
};

// Environment variables
const environmentVariables = {
'local': [
{
'replaceString': '{{envPath}}',
'value': ''
}
],
'dev': [
{
'replaceString': '{{envPath}}',
'value': ''
}
],
'qa': [
{
'replaceString': '{{envPath}}',
'value': ''
}
],
'uat': [
{
'replaceString': '{{envPath}}',
'value': ''
}
],
'prod': [
{
'replaceString': '{{envPath}}',
'value': ''
}
]
};

// Iterate over environmentVariables keys
for (const env of Object.keys(environmentVariables)) {

// Check if `env` was passed to gulp
if (process.argv.indexOf(`--${env}`) > -1) {

    // Set `gulp.environment` to `env`
    gulp.environment = env;
    break;
}

}

// Tasks
gulp.task('clean', require('./gulp-tasks/clean')(paths));
gulp.task('copy', require('./gulp-tasks/copy')(gulp, paths));
gulp.task('compile-scripts', require('./gulp-tasks/compile-scripts')(gulp, paths));
gulp.task('compile-styles', require('./gulp-tasks/compile-styles')(gulp, paths));
gulp.task('replace-environment-variables', require('./gulp-tasks/replace-environment-variables')(gulp, paths, environmentVariables));
gulp.task('server', require('./gulp-tasks/server')(gulp, paths, browserSync));
gulp.task('watch', () => {

// HTML
gulp.watch(
    [
        `${paths.src.root}**/*.html`,
        `${paths.src.fonts}**/*`,
        `${paths.src.images}**/*`
    ],
    gulp.series('copy', 'replace-environment-variables', (cb) => {
        browserSync.reload();
        cb();
    })
).on('error', function handleError() {
    this.emit('end');
});

// JS
gulp.watch(
    [`${paths.src.scripts}**/*.js`],
    gulp.series('compile-scripts', 'replace-environment-variables', (cb) => {
        browserSync.reload();
        cb();
    })
).on('error', function handleError() {
    this.emit('end');
});

// SCSS
gulp.watch(
    [`${paths.src.styles}**/*.scss`],
    gulp.series('compile-styles', 'replace-environment-variables', (cb) => {
        browserSync.reload('main.css');
        cb();
    })
).on('error', function handleError() {
    this.emit('end');
});

});

// Default
gulp.task('default',
gulp.series('clean', 'copy',
gulp.parallel('compile-scripts', 'compile-styles'),
gulp.parallel('replace-environment-variables'),
gulp.parallel('server', 'watch')
)
);

// Build
gulp.task('build',
gulp.series('clean', 'copy',
gulp.parallel('compile-scripts', 'compile-styles'),
gulp.parallel('replace-environment-variables')
)
);
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.