Gulp 4 Crash Course for Beginners

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 184

  • @TheCoderCoder
    @TheCoderCoder  3 года назад +20

    🚨 NOTE: If you're working on Gulp in 2021 and getting an error "gulp-sass 5 does not have a default compiler; please set one yourself" you will need to update the line:
    const sass =require('gulp-sass'); to instead read: const sass = require('gulp-sass')(require('sass'));

    • @alexs248
      @alexs248 11 месяцев назад

      If you're working on Gulp in 2023 you will need to update the line ... and you will need to install "sass" (npm i -D sass)

  • @SamFromaway
    @SamFromaway 4 года назад +13

    Great video, here for the ones that need it: npm install --save-dev gulp gulp-sass gulp-sourcemaps gulp-postcss autoprefixer cssnano gulp-concat gulp-uglify gulp-replace

  • @centori2011
    @centori2011 5 лет назад

    This has been the most fun I've had coding so far. I don't think I've learned so much in such a short time from any other Web Development tutorial. I really like the no nonsense approach, straight to the point and no wasted words just focused on the task at hand. I am really impressed and truly grateful for the best tutorial ever. Such a great teacher, thank you!

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      Thanks so much for your kind words! I'm glad this tutorial helped you out!

  • @NerdyPugStudios
    @NerdyPugStudios 5 лет назад +7

    This was great, thank you! The presentation, delivery of the content, and quality of the audio/video is perfect.

  • @jasonm9825
    @jasonm9825 3 года назад +2

    You're the coolest coder out there gurl! Thankssssssss

  • @charlyRoot
    @charlyRoot 5 лет назад +1

    I've been watching vids like this for years and this is the best one yet. I use webpack but spun up gulp yesterday for a small project. Yesterday I didn't know what everything was but just that it worked. Today I know every line and what it means. Rad!

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      Thanks so much! I'm glad you're enjoying Gulp and this helped you!

  • @Nischhal
    @Nischhal 5 лет назад +1

    I can't understand why your channel is so underated ... You just nailed every point a beginner should know while learning gulp. Thank you for making web a great place.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +1

      Thanks so much! I'm just starting on RUclips, hope to make many more videos in the future! :D

    • @Nischhal
      @Nischhal 5 лет назад

      @@TheCoderCoder Thank you for making Web development field easier to new developer.. This tutorial will encourage new developer to automate their process through Gulp.
      I will constantly be supporting your future projects or videos in form possible.

  • @rahsalghul
    @rahsalghul 2 года назад

    Gulp is a fantastic tool that is really well explained here. There are a couple of small adjustments required but they are easy fixed and added to the git repo if required. Best tuts on RUclips.

  • @Sh1vashish
    @Sh1vashish 2 года назад

    It helped me to get a quick overview of the Gulp 4, it's tasks and the processes .

  • @SauravKhare
    @SauravKhare 4 года назад +1

    This is a super useful video! Always wanted to use gulp but didn't know how to setup 😅 your video made things clear now. Thanks 👍 keep making such videos.

  • @apseh721
    @apseh721 4 года назад +1

    A super good tutorial for beginners like me. I have been struggling to find a module for php minification and removing white space etc, the whole day today without luck. Would be wonderful if you can add that functionality to this tutorial or maybe make a new one for HTML and php. Looking forward ! Thank you.

  • @mwafulirwa1
    @mwafulirwa1 5 лет назад

    watched this other tutorial which left me more confused about gulp...enjoyed this tutrial. much thanks Coder Coder!!!

  • @artemaz
    @artemaz 3 года назад

    You Fridgin Rock !!!!! I needed to migrate to Webpack from Gulp and I needed some Gulp 4 Knowledge like ASAP and this is all I needed!! Thanks haha

  • @prophetebaptiste566
    @prophetebaptiste566 3 года назад

    I congratulate you for sharing with the programmers world. Thank to you I just learned gulp

  • @koitaki
    @koitaki 4 года назад +1

    Nicely made tutorial, clear & succinct, covered the necessities, thanks for producing it! 👍

  • @wraithy1324
    @wraithy1324 5 лет назад +1

    Great tutorial, thank you a lot for sharing this!
    For those who struggle having autoprefixer working - adding specified browser versions made it work in my case:
    .pipe(postcss([ autoprefixer({browsers: ['> 1%', 'last 2 versions']}), cssnano() ]))

  • @AslamD
    @AslamD 5 лет назад +5

    This really very helpful. Thank you for Sharing Coder Coder :)
    Next thing I want to do to this Gulp file is, add BrowserSync (although I am using livereload from vscode) which I will try to figure out myself how to do.
    Also I would like to know how to add more JS and CSS files to this. E.g. bootstrap, slick carousel, fontawesome etc.
    Thanks again. Great work.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +1

      Thanks! That's a great idea-- I think I'll do a future Gulp tutorial w/ BrowserSync and more complex file setup.

    • @pawanbantawa7651
      @pawanbantawa7651 5 лет назад

      @@TheCoderCoder 5 months already. Where are we on browsersync video ? It would be better to adding browsersync on where we left from i.e your starter template

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      @@pawanbantawa7651 Sorry, I'm working on some other projects currently, not sure when I'll get to this one. But if you check out the Browsersync site they have instructions on setting up in Gulp, I'm sure you'll be able to get it working 👍

    • @derickmoncado
      @derickmoncado 5 лет назад

      @@TheCoderCoder Pleeeeeease make the browsersync vid! I for the life of me cannot figure it out :/

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      @@derickmoncado I'll try to work on this soon!!

  • @anthonyforsey
    @anthonyforsey 5 лет назад +4

    Thank you for the cache busting task and clear explanations

  • @dianagasper9539
    @dianagasper9539 5 лет назад +1

    Great tutorial. Saved me a lot of time and headaches. Very grateful!

  • @rickzhong6657
    @rickzhong6657 3 года назад +1

    Thanks for the helpful tutorial, just one comment: cbString should be defined inside cacheBustTask function instead, so that the string value got updated each time when the gulp watch session is still running with every SCSS/JS update at real-time.

  • @weblearningd2294
    @weblearningd2294 2 года назад

    You are the best tech teacher!🎉❤

  • @mnchabel8402
    @mnchabel8402 4 года назад

    Like the cache busting task, thank you

  • @AhsenBaig
    @AhsenBaig 5 лет назад +1

    Good job on the tutorial. Update your watchTack to include the cacheBustTask() else versions won't update.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +1

      thanks so much! I have updated the GitHub repo with cache busting in the watch task :)

    • @mortkebab2849
      @mortkebab2849 4 года назад

      @@TheCoderCoder Oh, I was wondering about that and couldn't quite see what was going on.

    • @ilirkokollari1027
      @ilirkokollari1027 4 года назад

      Yeah, I think she hit shift+f5 on the video :)

  • @user-vatican
    @user-vatican 8 месяцев назад

    спасибо вам , я просто счастлив что ваше видео попала в мое поле зрение, Респект вам

  • @mlunatico
    @mlunatico 5 лет назад +1

    Awesome tutorial, clear explanations, very well narrated as you typed.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      thanks so much! I try to explain well :)

  • @rebeccode4141
    @rebeccode4141 5 лет назад +5

    My javascript file had ES6 code in it - js uglify doesn't support ES6 so it threw an error.
    I replaced js uglify with terser and it worked great!

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +2

      Glad you were able to fix it! I probably should add Babel to this workflow for ES6 compatibility.

    • @raymondmichael4987
      @raymondmichael4987 4 года назад

      Coder Coder, that'll be great. At what line should I include babel?

  • @salsaldare8585
    @salsaldare8585 4 года назад

    great video, quite fastidious, enjoyed learning from you. I will be checking out your gulp-course

  • @alvin_lal
    @alvin_lal 3 года назад

    Please note that you have to provide a browser list for autoprefixer to work like
    .pipe(postcss([autoprefixer("last 2 versions"), cssnano()]))
    or specify browserlist in your package.json

  • @mario.cvetkovski
    @mario.cvetkovski 5 лет назад

    Thank you so much for this tutorial you really helped me alot. I would like to see more advanced tutorial about Gulp4 in the future.
    Thanks again.

  • @carstenwendelnielsen9433
    @carstenwendelnielsen9433 5 лет назад +2

    Thanks for a great lesson. You tell and instruct it super well. You're really Cool.

  • @kevyyar
    @kevyyar 4 года назад

    Please make a FullStack course! You explain Soo good where were you before I started learning??!

  • @Spectraevil
    @Spectraevil 4 года назад

    Love that mechanical keyboard.

  • @guilhermegirardi
    @guilhermegirardi 5 лет назад

    Thank you, very much!!! I was looking for something like that, specifically like that! Thanks a million!

  • @iamaakashbasnet
    @iamaakashbasnet 4 года назад

    Really good video! Subscribed! 😍😍

  • @SilentWPDev
    @SilentWPDev 5 лет назад

    You are just great. You solved my every question. love you

  • @AlexanderSuleymanovFX
    @AlexanderSuleymanovFX 5 лет назад

    Thank you so much for this video! It helped me started with Gulp quickly.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      You're very welcome! I'm glad it could help get you started.

  • @ridwangumz10
    @ridwangumz10 5 лет назад

    this is what i need. thanks for making this video. you're awesome :)

  • @MD-cu8tt
    @MD-cu8tt 5 лет назад +1

    Thank you very much for this video it really save my time I wish if you do another tutorial for building a bootstrap workflow with gulp and browser-sync I tried to figure it out by myself following bootstrap doc. but I failed please if you have time explain it for us.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      You're very welcome! I will plan on doing another Gulp video in the near future w/ BrowserSync and more complex setup :)

  • @shawnjohnson3433
    @shawnjohnson3433 5 лет назад

    Keep getting this:
    new-host-6:frontend-boilerplate shawnjohnson$ gulp
    [00:12:58] Using gulpfile ~/GitHub/frontend-boilerplate/gulpfile.js
    [00:12:58] Task never defined: default
    [00:12:58] To list available tasks, try running: gulp --tasks
    Then when I run the gulp --tasks I get this:
    [00:22:19] Tasks for ~/GitHub/frontend-boilerplate/gulpfile.js
    [00:22:19] └─┬
    [00:22:19] └─┬
    [00:22:19] ├─┬
    [00:22:19] │ ├── scssTask
    [00:22:19] │ └── jsTask
    [00:22:19] ├── cacheBustTask
    [00:22:19] └── watchTask

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      Hi, I think this is due to a bug for some people in Gulp v4.0.0. If you update the package.json from the GitHub repo, or update your Gulp version it should fix this!

  • @DorkMagnetChannel
    @DorkMagnetChannel 5 лет назад

    Good tutorial, learned a lot about gulp 4!

  • @TienPham-ou1wl
    @TienPham-ou1wl 4 года назад

    Thank You ! How to reuse it in a different projects .

  • @oakleyorbit
    @oakleyorbit 5 лет назад

    Thank you so much this has been really helpful, keep up the great work!

  • @jp-cb1sw
    @jp-cb1sw 5 лет назад +4

    Cool intro!!

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +2

      Thanks so much! My husband is a super talented video editor and animator :D

  • @manmeetmak
    @manmeetmak 5 лет назад +1

    Thanks for great tutorial, why you don't use browserSync?

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +2

      I usually just reload manually because I like being able to compare the before and after of if updated CSS works. But I'll do another Gulp tutorial in the future using BrowserSync-- it's requested a lot :)

    • @manmeetmak
      @manmeetmak 5 лет назад

      @@TheCoderCoder oh wow! I am really excited to watch that tutorial. I am learning gulp so If you will upload that tutorial. that will be great. btw, your videos are really awesome. Thanks again. :)

  • @mhasancoder
    @mhasancoder 5 лет назад

    You intro is awesome 💯

  • @bambanx
    @bambanx 5 лет назад +1

    thanks for share but i think for this setup needs browsersync too its essential.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +1

      The next video will be about Browsersync in Gulp :)

  • @MrVisheshsingh
    @MrVisheshsingh 4 года назад

    Wow, amazing explanation!

  • @tedshapera8062
    @tedshapera8062 4 года назад

    Great Video! You have a great (don't worry, everything's ok) voice!
    So do you still use gulp for the majority of your projects or Parcel now? (I like Parcel too but I have had trouble with setting it up to do vendor prefixes with autoprefixer - apparently others have experienced this too).
    Thanks again, really like your channel!

    • @TheCoderCoder
      @TheCoderCoder  4 года назад

      Thanks! I will usually use Gulp or the VS Code Live Sass extension. But I'd like to go back and experiment with Parcel more in the future!

  • @simonepuhl
    @simonepuhl 4 года назад

    Very good video, thanks. Only thing is that from what was said in the first minute I thought you were also going to show how I can re-use this for future projects (with minimal effort). But I guess I'll have to always install all the npm packages I want to use in that project in the terminal for each new project to get the package.json file with the devDependencies? And then copy my Gulpfile.js?

    • @TheCoderCoder
      @TheCoderCoder  4 года назад +1

      Yep exactly! We'll always have to install the npm packages and copy the gulpfile to get started.

    • @simonepuhl
      @simonepuhl 4 года назад

      @@TheCoderCoder Thank you for the quick reply. That is exactly what I will do from now on then. Have a good day :)

  • @cyrillefordmulaan7277
    @cyrillefordmulaan7277 2 года назад

    Hi, I am a beginner and still confused specially in gulp, should I still use gulp now adays? Hoping for a replyy :)

  • @ithelightr3020
    @ithelightr3020 2 года назад +1

    does not recognize gulp as a command - followed all instructions - even downloaded the repo and did not work - i installed it globally too

  • @JohannesKuenel
    @JohannesKuenel 5 лет назад

    Thank you, that really helped for the new gulp 4 syntax! You deserve way more followers! I was relieved to see that you're quite popular on Instagram though :-)
    One question: At work, as a convention we don't check the node modules into the code management system. That's obviously for good reasons. But in this setup, there are quite a few plugins from gulp alone. So it would be quite a hassle to set up the environment on any new device or for any new team member. So would you consider checking in the node modules or is there a more elegant solution?

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      Thanks so much! For all the Gulp-related npm packages, I generally save them as dev dependencies in the package.json. So any dev that needs to run the project, running "npm install" will install all of those. They will also have to install the Gulp CLI on their computer. But other than that, it should all work for anyone!

  • @ixlidoldesign2039
    @ixlidoldesign2039 5 лет назад

    Awesome, great tutorial. Thank you .. !!!

  • @winnusjohn
    @winnusjohn 5 лет назад

    Thanks for this. This really helped me!!!

  • @UBO58
    @UBO58 4 года назад

    Thanks a lot for this excellent tutorial!

    • @TheCoderCoder
      @TheCoderCoder  4 года назад

      you're welcome, so glad you enjoyed it!

  • @sairfan06
    @sairfan06 2 года назад

    How can i run only one task on demand, for example i just want to regenerate js files.

  • @david19rp
    @david19rp 5 лет назад

    Thanks for this video, is very helpful!!

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +1

      Thanks so much! Glad it's helpful :)

  • @CorporalPoon
    @CorporalPoon 5 лет назад +1

    extremely helpful, thank you

  • @DeepakNaidu
    @DeepakNaidu 5 лет назад

    Awesome pace and video editing. Learnt more than I was hoping for in this.
    Explaining on the concepts as you write code was a nice and it was like a thought process.

  • @24mjohnson
    @24mjohnson 5 лет назад

    How do you add browsersync to this gulpfile.js?

  • @RtSAdventuresLLC
    @RtSAdventuresLLC 5 лет назад

    Thank you, very helpful!

  • @vishalmule9829
    @vishalmule9829 5 лет назад +1

    i am follow all steps but give me this error->>>> Cannot find module 'concat' >>>> in CMD when i run gulp command.. and i am also change your folder name app to src.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      This probably means you didn't install gulp-concat? You will also need to update your folder names in the gulpfile.js to use the folder names you have.

  • @coupleadventuresph4015
    @coupleadventuresph4015 2 года назад

    Is it okay to be dependent on VS code extensions?

  • @princetanwar5694
    @princetanwar5694 3 года назад

    which keyboard you using in this video.

  • @HimasRafeek
    @HimasRafeek 5 лет назад

    Awesome, Thank you!!

  • @DreidyMontilla
    @DreidyMontilla 5 лет назад

    Excellent video I don't know if you could still put browser sync

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      Thanks! I don't usually use browser sync, but I believe it works pretty well with Gulp

    • @DreidyMontilla
      @DreidyMontilla 5 лет назад

      This is the link www.browsersync.io/ Check and see how it goes and then tell me.

    • @wraithy1324
      @wraithy1324 5 лет назад

      install browser-sync package with npm
      Then add:
      const autoprefixer = require('autoprefixer');
      In sassTask() and jsTask() function after .pipe(dest('dist')) add:
      .pipe(browserSync.stream())
      Then inside watchTask it should look like this:
      function watchTask(){
      browserSync.init({
      server: {
      baseDir: './'
      }
      });
      watch([files.scssPath, files.jsPath],
      parallel(sassTask, jsTask));
      watch('./*.html').on('change', browserSync.reload);
      }
      I don't know if it's done properly, but it works for me ;p

  • @renixmar3373
    @renixmar3373 5 лет назад

    the scss didn't work for me, it was cause i had another name than the one on the index.html, isn't it supossed to automatically catch it from the gulpfile?

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      You do need to make sure the CSS file references in the index.html is the same filename as your main SCSS file. Meaning if you are loading styles.css in your index.html file, your main SCSS file needs to be called styles.scss. Hope this helps!

  • @volkancansogut6778
    @volkancansogut6778 5 лет назад

    Amazing! Thank you...

  • @sabuein
    @sabuein Год назад

    Thank you.

  • @codingwithmitch
    @codingwithmitch 5 лет назад

    Found it 😎

  • @umersaeed259
    @umersaeed259 5 лет назад

    gulp command not found after installing gulp and gulp-cli globally.. waht is that?

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      If you have gulp installed globally, you'll need to uninstall it before installing gulp-cli globally. Then in each project using Gulp, you'll need to install whatever gulp version you need just for that project, in the project folder.

  • @MaxWeir
    @MaxWeir 4 года назад

    How would you include browser sync in this workflow so you don’t have to keep refreshing the page?

    • @TheCoderCoder
      @TheCoderCoder  4 года назад

      I'm planning on making a video on browsersync at some point-- for now I only have that material in my Gulp course (link in descr)

  • @hi_im_willow
    @hi_im_willow 2 года назад

    Thank you thank you soo much

  • @The4tticuz
    @The4tticuz 5 лет назад

    Why you dont concat the SASS files to a single bundled CSS file?

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      I am-- all the Sass files are getting compiled and optimised into one final CSS file, /dist/style.css. Is that what you mean?

  • @HohenheimIsMyHomeboy
    @HohenheimIsMyHomeboy 5 лет назад

    This is such a great video. Thanks for breaking it down so clearly. I did run into an issue at the end though, which no amount of Googling seems to solve! When I try to run the gulp command to test if all my tasks are working, I get an error "gulp : The term 'gulp' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
    was included, verify that the path is correct and try again." I've tried a few StackOverflow-recommended fixes, but nothing works. Any ideas? Is this something anybody else has ran into?

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      Hi, that usually means that you don't have gulp installed as part of your command line. Previously you had to install gulp globally and add it to your path in Windows. However, that's no longer recommended. Make sure you have gulp-cli installed globally, and that will ensure you can run gulp on your command line.

  • @denismekina
    @denismekina 4 года назад

    Thank you so much!

  • @mortkebab2849
    @mortkebab2849 4 года назад

    I'm a confused beginner. I understand how to do all this on a local Windows computer just as you do, with VS Code, and Powershell as the terminal. How would I do it on a Linux vps? I mean, I use the remote server extension in VS Code to work on a vps filebase as though it were local and with an ssh terminal in VS Code. That's great. Is there a way to run Gulp on the vps to have all the same functionality I would have it were local?

    • @TheCoderCoder
      @TheCoderCoder  4 года назад

      I haven't set up Gulp on the type of enviro you're working on. But generally you can run the same install commands on a production server just the same as a local one. What people do is run a command line command on a server when you deploy. So it will automatically run Gulp every time you deploy to that server.

    • @mortkebab2849
      @mortkebab2849 4 года назад

      @@TheCoderCoder Thank you for your prompt reply. I have it working now, with a little help from additional reading on Stackexchange, although I need to hit "refresh" in my browser after making a change to the page because my local browser is not under the control of the Gulp instance running on the server.

  • @ErikPlaysAGame
    @ErikPlaysAGame 5 лет назад

    Thanks for your video. Unfortunately I get the "ReferenceError: parallel is not defined
    ". Any idea why? have have the same code as you have.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      Hi, you might need to update your package.json with what I have on the GitHub repo-- I think installing Gulp v4.0.2 fixes some of these issues.

  • @alexm5363
    @alexm5363 4 года назад

    Will this work for updating / compiling SCSS on a live WordPress website? If so, how would you go about it? If not, could you lead me in the right direction? Thank you in advance! I read your post on FreeCodeCamp about Gulp 4. Much Appreciated!

    • @TheCoderCoder
      @TheCoderCoder  4 года назад +1

      Thanks for reading! Yes, you can use this in Wordpress setups (I do for my blog). You can add your gulpfile.js in your theme folder, and just make sure that your theme files reference the final CSS/JS files after Gulp has compiled them. Hope this helps!

    • @alexm5363
      @alexm5363 4 года назад

      @@TheCoderCoder Thank you!

    • @alexm5363
      @alexm5363 4 года назад

      Aahhh, one more question. How do you implement cache-busting in WordPress since there is no index.html file. Honestly, I'm pretty new to WP and PHP and have been trying to get this live website to update my SCSS changes to the server for days. I've tried FileZilla, ssh, clearing my cache to see changes, and gulp but all videos and tutorials related to WordPress seem to be outdated or have some issue. I really appreciate your help!

    • @TheCoderCoder
      @TheCoderCoder  4 года назад +1

      @@alexm5363 That is a bit tricky-- I have a blog post on Gulp on how to add cachebusting. (coder-coder.com/gulp-4-walk-through/) The trick is to figure out how to cachebust in a classic Wordpress scenario. It may involve the functions.php file

  • @TheSclare
    @TheSclare 5 лет назад

    Many thanks!

  • @philip9677
    @philip9677 4 года назад

    Hi I was wondering how would you add browsersync to this setup to automatic browser refresh when any files are changes js/css or html

    • @philip9677
      @philip9677 4 года назад +1

      So i got this to work with browserSync not sure if i did i right but it watches my html and sass and reloads on edit save: this is my gulfile.js:
      //Initialize modules
      const { src, dest, watch, series, parallel } = require('gulp');
      const autoprefixer = require('autoprefixer');
      const cssnano = require('cssnano');
      const concat = require('gulp-concat');
      const postcss = require('gulp-postcss');
      const replace = require('gulp-replace');
      const sass = require('gulp-sass');
      const sourcemaps = require('gulp-sourcemaps');
      const uglify = require('gulp-uglify');
      const browserSync = require('browser-sync').create();
      //File path variables
      const files = {
      scssPath: 'app/scss/**/*.scss',
      jsPath: 'app/js/**/*.js',
      htmlPath: './*.html'
      };
      //Sass task
      function scssTask() {
      return src(files.scssPath)
      .pipe(sourcemaps.init())
      .pipe(sass())
      .pipe(postcss([ autoprefixer(), cssnano() ]))
      .pipe(sourcemaps.write('.'))
      .pipe(browserSync.stream())
      .pipe(dest('dist'));
      }
      function htmlTask() {
      return src(files.jsPath).pipe(concat('all.js')).pipe(uglify()).pipe(dest('dist'));
      }
      //JS task concat minify
      function jsTask() {
      return src(files.htmlPath).pipe(browserSync.stream()).pipe(dest('dist'));
      }
      //Cachebusting task no need to clear
      const cbString = new Date().getTime();
      function cacheBustTask() {
      return src([ 'index.html' ]).pipe(replace(/cb=\d+/g, 'cb=' + cbString)).pipe(dest('.'));
      }
      //watch task
      function watchTask() {
      browserSync.init({
      server: {
      baseDir: './'
      }
      });
      watch([ files.scssPath, files.jsPath, files.htmlPath ], parallel(scssTask, jsTask, htmlTask));
      }
      //default task
      exports.default = series(parallel(scssTask, jsTask), cacheBustTask, watchTask);

    • @TheCoderCoder
      @TheCoderCoder  4 года назад +1

      @@philip9677 That's great! I'm actually planning on doing a Gulp + Browsersync video soon too 👍

    • @peterchapman8573
      @peterchapman8573 4 года назад +1

      @@philip9677 just what i was looking for works perfectly. well done.

  • @abdallahmuhaisen9096
    @abdallahmuhaisen9096 4 года назад

    Love the video, but could we please mute the keyboard strokes sounds. It hurts the mind.

  • @MarceloPereiraSongs
    @MarceloPereiraSongs 5 лет назад +2

    Como fazer autoprefixer funcionar?

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      Autoprefixer is run through PostCSS. hope this answers your question!

    • @bambanx
      @bambanx 5 лет назад

      agrega esto en package.json "browserslist": [
      "last 3 version",
      "not dead",
      "> 0.2%"
      ],
      add that on package.json ;)

  • @MariusDuboule
    @MariusDuboule 5 лет назад

    Thank you for this helpful video, it works great but I'm having issues with the autoprefixer. Any clue what I'm missing on? I've imported the dependency properly and verified the gulpfile.js but couldn't find any mistake… thanks again!

    • @MariusDuboule
      @MariusDuboule 5 лет назад

      My bad it took me some time to realize how few prefixes are actually necessary nowadays… it's working just fine, thanks again.

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      @@MariusDuboule Cool, glad you got it working!

  • @logimw
    @logimw 4 года назад

    how to add a browserSync to similar gulpfile?

    • @logimw
      @logimw 4 года назад

      Ok, after few tries I did it

  • @pablosouza2687
    @pablosouza2687 5 лет назад

    Excellent tutorial!! I'm being thrown an error that seems to be related to the gulp.replace. Any ideas? :)
    [14:50:22] Starting 'cacheBustTask'...
    [14:50:22] 'cacheBustTask' errored after 4.43 ms
    [14:50:22] TypeError: Cannot create property 'skipBinary' on number '1573620621229'
    at module.exports (/Users/pablosouza/Desktop/Projects/teacher/node_modules/gulp-replace/index.js:13:24)
    at cacheBustTask (/Users/pablosouza/Desktop/Projects/teacher/gulpfile.js:42:11)
    at bound (domain.js:402:14)
    at runBound (domain.js:415:12)
    at asyncRunner (/Users/pablosouza/Desktop/Projects/teacher/node_modules/async-done/index.js:55:18)
    at process._tickCallback (internal/process/next_tick.js:61:11)

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад +1

      Thanks! Hmm, I'm not sure what's happening for you-- could you post a copy of your gulpfile.js to Codepen or GitHub and send me the link?

    • @pablosouza2687
      @pablosouza2687 5 лет назад

      Coder Coder thanks for the prompt reply... I was having problems with permission because of untidy node installation but now it’s fixed. Thanks!

    • @TheCoderCoder
      @TheCoderCoder  5 лет назад

      @@pablosouza2687 Glad you resolved the issue!

  • @PhilKerrigan
    @PhilKerrigan 5 лет назад

    Thank you!!!

  • @LeonoraKuffa
    @LeonoraKuffa Год назад

    cool video)

  • @codeAlongwith
    @codeAlongwith 4 года назад

    How would you add browser-sync to this?

    • @TheCoderCoder
      @TheCoderCoder  4 года назад +1

      I'll be posting a video on using Browsersync in Gulp in January! 😁

    • @codeAlongwith
      @codeAlongwith 4 года назад

      @@TheCoderCoder Looking forward to it as this is a very good video!

    • @codeAlongwith
      @codeAlongwith 4 года назад

      @@TheCoderCoder
      import browserSync from 'browser-sync';
      export const serve = (done) => {
      server.init({
      proxy: 'localhost/yoursite'
      });
      done();
      };
      export const watch = () => {
      gulp.watch('src/assets/scss/**/*.scss', styles);
      gulp.watch('src/assets/js/**/*.js', gulp.series(scripts, reload));
      gulp.watch('**/*.php', reload);
      gulp.watch(paths.images.src, gulp.series(images, reload));
      gulp.watch(paths.other.src, gulp.series(copy, reload));
      };
      export const dev = gulp.series(clean, gulp.parallel(styles, scripts, images, copy), serve, watch);

  • @leslinks
    @leslinks 5 лет назад

    very helpful...

  •  5 лет назад

    Nice one

  • @raymondmichael4987
    @raymondmichael4987 4 года назад

    Subed

  • @jeremydavis7204
    @jeremydavis7204 4 года назад

    The cache busting thing is unnecessary. Good tutorial though.

    • @TheCoderCoder
      @TheCoderCoder  4 года назад

      I've found cachebusting pretty useful. Thanks for watching!

  • @VictorMorettiOfficial
    @VictorMorettiOfficial 3 года назад

    Awesome tutorial. Thank you!

  • @KevinJohnKiely
    @KevinJohnKiely 4 года назад

    Thanks so much, really helpful!

  • @techtipsuk
    @techtipsuk 4 года назад

    Fantastic, thank you so much.

  • @StanleyBateswar
    @StanleyBateswar 5 лет назад

    Very useful thank you!

  • @АнастасіяПлюхіна
    @АнастасіяПлюхіна 10 месяцев назад

    cool video)