This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Import of the file where we define/fetch data | |
| const api = require('./server/api'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { ApolloServer } = require('apollo-server'); | |
| // Import of the file where we define/fetch data | |
| const api = require('./server/api'); | |
| // Import of the file where we build data structures/schemas | |
| const typeDefs = require('./server/schema'); | |
| // Bind queries from schemas definition to data from API's | |
| const resolvers = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { watch, src, dest, series, parallel } = require('gulp'); | |
| const browserSync = require('browser-sync').create(); | |
| const babel = require('gulp-babel'); | |
| const concat = require('gulp-concat'); | |
| const uglify = require('gulp-uglify'); | |
| const rename = require('gulp-rename'); | |
| const del = require('del'); | |
| const postcss = require('gulp-postcss'); | |
| const sass = require('gulp-sass'); | |
| const autoprefixer = require('autoprefixer'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.build = series(cleanUp, parallel(jsTask, cssTask, fontTask, imagesTask, templateTask)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function cssTask(done) { | |
| src(config.app.scss) | |
| .pipe(sass({ outputStyle: 'expanded' })) | |
| .pipe(rename({ suffix: '.bundle' })) | |
| .pipe(postcss([autoprefixer(), cssnano()])) | |
| .pipe(dest(config.dist.base)) | |
| done(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const config = { | |
| app: { | |
| js: [ | |
| './src/scripts/**/*.js', | |
| ], | |
| scss: './src/style/**/*.scss', | |
| fonts: './src/fonts/*', | |
| images: './src/images/*.*', | |
| html: './src/*.html' | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Coercive / loose comparison | |
| if (5 == '5') { | |
| console.log('Coercion please!'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let boots | |
| // Value assignemnt anti-pattern | |
| if (boots = 'green') { | |
| console.log(boots); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Non-coercive / strict comparison | |
| if ( 5 === 5 ) { | |
| console.log('No coercion please!'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Let's say that bank account | |
| let money = 1E6; | |
| // Your hard work pays off | |
| money = money + Number('.6E6'); | |
| // That looks better :) | |
| console.log(money); // 1 600 000 |