Gulp 4.0 Tutorial 2020 | Concat & Minify Your CSS and JS

  Рет қаралды 28,573

Sam Fromaway

Sam Fromaway

Күн бұрын

Пікірлер: 81
@cmefindaname
@cmefindaname 2 жыл бұрын
👏 Thanks man! Just what I needed. Perfect crash course for gulp. I was able to modify for my folder structure and add a few more tasks after tinkering and referencing your video a few times.
@arshiagholami7611
@arshiagholami7611 3 жыл бұрын
you are amazing sir, saved my assignment
@Sohrabziagoogle
@Sohrabziagoogle 4 жыл бұрын
Thank you. Finally I know what this folder structure means.
@jaydeepgoswami909
@jaydeepgoswami909 2 жыл бұрын
Great work. Easily explained the complex task.
@fernandodiegosantillanvara1108
@fernandodiegosantillanvara1108 Жыл бұрын
thanks bro!! You did amazing work!! I try in another videos but this is the pro. I recomend to install the version 7 the gulp-imagemin
@deividaskrupstas
@deividaskrupstas 4 жыл бұрын
Never clicked subscribe button so fast 😉! Thank you!
@alvarouribe8416
@alvarouribe8416 4 жыл бұрын
WOW amazing sir ! 🙏🏽 excellent video, it was exactly what I was looking for and I was looking the terser solution. You have a new subscriber
@alexandrebrunoalvarenga8862
@alexandrebrunoalvarenga8862 4 жыл бұрын
tks for this example,it was great man
@bocarwane8779
@bocarwane8779 3 жыл бұрын
Awesome video, I really appreciate!
@Rodrigo-nx4fg
@Rodrigo-nx4fg 4 жыл бұрын
Thanks for your time to explain this!.. very clear and powerful, Awesome!! ❤️
@Yolosopher27
@Yolosopher27 3 жыл бұрын
Really nice video, thanks. After 3-4 gulp tutorials couple of months ago, I gave up learning it because I didn't have a need to and found it really confusing. Now I needed and after watching this, you made me realize how this thing and it's config work. Could you also teach us Webpack and it's config with the explanation of this quality? :D Would be really nice.
@SamFromaway
@SamFromaway 3 жыл бұрын
Thanks a lot, glad it helped. A video about webpack is not planned yet, but maybe in the future.
@cesaraugusto-ko6fj
@cesaraugusto-ko6fj 3 жыл бұрын
Achei ótimo o vídeo, muito prático, me ajudou muito, vlw
@abhishekrajput2014
@abhishekrajput2014 3 жыл бұрын
Hi , i am trying to use gulp-imagemin but its showing error that we can't require this module and we should rather import it(after importing this particular module by using "type":"module" in my json file and import statement in gulpfile ,it is prompting me to convert all the require statements to import) , but as I have used require at several places in my project it is very difficult to import each and every module and path, can you tell some method that we can do to import imagemin rather than importing it?
@codecobber1107
@codecobber1107 4 жыл бұрын
Absolutely superb, thank you so much.
@Recetasdeabuela
@Recetasdeabuela 3 жыл бұрын
Thnaks!!! finally I understand (more or less) that shit!!
@TazExprez
@TazExprez 4 жыл бұрын
Thanks a lot! Great Gulp 4 tutorial!
@SamFromaway
@SamFromaway 4 жыл бұрын
Thanks :D
@ExplaineRKhaN
@ExplaineRKhaN 3 жыл бұрын
thank u sir from the core of my heart
@ashishkurambhatti2218
@ashishkurambhatti2218 2 жыл бұрын
Hey, Can you tell me if I can minify my internal css(present in tag ) and internal js(present in tag ) into minfied file? If can can you share any steps on the same. Thanks in advance.
@kurtziwa
@kurtziwa 3 жыл бұрын
thanks for your tutorial however, how to add using browser-sync? if changed JS or SCSS browser-sync
@bradwhite5411
@bradwhite5411 3 жыл бұрын
Hey mate, I think this guide is perfect for me, do you have a tutorial on how to deploy it in Netlify and make it live. I tried to deploy the files you have here but I can't make it work at all. Please advise hopefully add some browserSync too if possible
@cristinamihaela9844
@cristinamihaela9844 4 жыл бұрын
Excellent channel. Subscribed.
@SamFromaway
@SamFromaway 4 жыл бұрын
Appreciate it :D
@matthieudewaele3366
@matthieudewaele3366 4 жыл бұрын
You're the best !
@madog666
@madog666 4 жыл бұрын
Hey man. Really awesome tutorial! I support! But you know there will always be some "but". I'm not some expert so don't mind if I say something stupid, so here it is: What if I want to have multiple .js files like modules but not modules, no type="modules" in html, and I want before my .html run the main script, for example "script.js", that app.js and ui.js go trough concatenation and terser and that output of those two be that main "script.js" and to be placed in src/js folder? Here comes the biggest issue that I don't get: That function that you have writen works fine, all good. But how should I write a function in Gulp, so that I use multiple .js failes just like modules type but that .html loads only main script.js that is located .pipe(gulp.dest('src/css')) in src folder along other all .js files. So that I can run later some build function task and copy all files I want into my dist folder. I want that while I work just like in scss/css that files are updated automaticly on a change/save thing everything is done into that one main .js file that my html loads. Is it possible, or my imagination is way off limit? :D Thanks
@tiiesb916
@tiiesb916 4 жыл бұрын
is it possible to configure browser synchronization? Thank you
@georgesmith3022
@georgesmith3022 3 жыл бұрын
very good video, thanks
@marciazegarra8193
@marciazegarra8193 4 жыл бұрын
Thank you so much!
@masbroto378
@masbroto378 4 жыл бұрын
it's so cool and helpfull. thanks
@ifeoluwaonigbinde3250
@ifeoluwaonigbinde3250 4 жыл бұрын
Thank you soooo much!!!!
@e11world
@e11world 3 жыл бұрын
Beautiful plugin. Would love to do more on the cachebusting and purgecss integration on this. Much appreciated
@thobelanitabalaza8566
@thobelanitabalaza8566 4 жыл бұрын
Thanks bro, quick to the point.... hey could you do one for react,sass/scss and gulp please
@SamFromaway
@SamFromaway 4 жыл бұрын
Thanks, with react I would highly suggest using create-react-app instead of using gulp.
@gabrielfono844
@gabrielfono844 4 жыл бұрын
thanks I was struggling of using uglify. you are right it doesn't support ES6 thanks
@SamFromaway
@SamFromaway 4 жыл бұрын
cool, glad that it helped, took me a while to find it out :D
@gabrielfono844
@gabrielfono844 4 жыл бұрын
@@SamFromaway thanks a lot. save me time for sure
@germanduterte7110
@germanduterte7110 3 жыл бұрын
Nice tutorial
@SamFromaway
@SamFromaway 3 жыл бұрын
Thanks
@utshomomen
@utshomomen 4 жыл бұрын
if you saw an error of cssTasks then please install separately postcss because the the one with the gulp-postcss doesn't work. npm install postcss --save-dev
@yurionthecode
@yurionthecode 3 жыл бұрын
tnks bro
@andersonpires9318
@andersonpires9318 4 жыл бұрын
Thank u, bro!
@rubayet7566
@rubayet7566 4 жыл бұрын
If I delete a html file from "./src" folder, then I need to delete files automatically from "./dist" folder too. how can I do this?
@deividaskrupstas
@deividaskrupstas 4 жыл бұрын
Can you include scss for CSS ?
@pyongits
@pyongits 3 жыл бұрын
Thank youu ❤
@Flame-on-f2p
@Flame-on-f2p 4 жыл бұрын
hey Dev world iam a joiner web dev and im completely lost on what should i learn for tasks weither gulp or webpack if you can make a video on what should learn like a road map for new developers
@SamFromaway
@SamFromaway 4 жыл бұрын
Hey Mano, I just published the Parcel js video. kzbin.info/www/bejne/fafTYmaYa9eUnsU Soon I'll have a video with my workflow.
@guilhermegirardi
@guilhermegirardi 4 жыл бұрын
Thank you very much! Do you know how can I deploy a project with Gulp on Netlify?
@SamFromaway
@SamFromaway 4 жыл бұрын
Thanks. I have a video on Netlefy here kzbin.info/www/bejne/el7Fh618hsSgi6s. Just put in your build command in the option build & deploy or while setting up the site.
@guilhermegirardi
@guilhermegirardi 4 жыл бұрын
@@SamFromaway Thanks for that, I appreciate it. I was struggling cos' I thought that I had to run 'gulp' before starting the project.
@SamFromaway
@SamFromaway 4 жыл бұрын
@@guilhermegirardi Yes I usually set it up like that, so if you have changes you don't have to rebuild it manually but you can just push the changes to github and netlify will automatically rebuild the site with gulp
@jeffz2010
@jeffz2010 4 жыл бұрын
If anyone gets this error: Unsupported platform for inotify@1.4.6: wanted {"os":"linux","arch":"any"} (current: {"os":"win32","arch":"x64"}) Use this syntax: npm install gulp-sourcemaps --save-dev npm install gulp-concat --save-dev npm install gulp-terser --save-dev
@ravisoni6262
@ravisoni6262 3 жыл бұрын
Hi, I'm using mac and getting this message: "-bash: gulp: command not found"
@SamFromaway
@SamFromaway 3 жыл бұрын
Your probably did not install gulp the right way
@gerryleonugroho
@gerryleonugroho 4 жыл бұрын
And when I tried to run the gulp jsTask, got the following error. Any ideas how this happened? Error: Cannot find module '/Volumes/DATA/Automation/project/node_modules/d/index.js'. Please verify that the package.json has a valid "main" entry at tryPackage (internal/modules/cjs/loader.js:329:19) at Function.Module._findPath (internal/modules/cjs/loader.js:690:18) at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1017:27) at Function.Module._load (internal/modules/cjs/loader.js:899:27) at Module.require (internal/modules/cjs/loader.js:1090:19) at require (internal/modules/cjs/helpers.js:75:18) at Object. (/Volumes/DATA/Automation/project/node_modules/memoizee/lib/configure-map.js:7:24) at Module._compile (internal/modules/cjs/loader.js:1201:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10) at Module.load (internal/modules/cjs/loader.js:1050:32) { code: 'MODULE_NOT_FOUND', path: '/Volumes/DATA/Automation/project/node_modules/d/package.json', requestPath: 'd' }
@SamFromaway
@SamFromaway 4 жыл бұрын
Check the package.json file and check if in the object the key: main is your main js file
@gerryleonugroho
@gerryleonugroho 4 жыл бұрын
@@SamFromaway thanks, my bad. Encountered minor typos
@SamFromaway
@SamFromaway 4 жыл бұрын
Life of a programmer :D
@gerryleonugroho
@gerryleonugroho 4 жыл бұрын
@@SamFromaway haha, so true, love the videos you've been putting up on youtube. please stays safe during the pandemic. warmest regards from jakarta, indonesia.
@SamFromaway
@SamFromaway 4 жыл бұрын
@@gerryleonugroho Thanks, stay safe, greeting from Colombia ;)
@VileEnd
@VileEnd 4 жыл бұрын
So if I have Sass/css files which are in more than one place can I use an array for the arc and dest or what is the best option?
@SamFromaway
@SamFromaway 4 жыл бұрын
I did not find anything in the documentation, let me know if you found a solution. But for other reasons too it's probably best to have all your CSS in one folder. What you can do if there is no quick solution is just have more than one CSS task for the different locations.
@VileEnd
@VileEnd 4 жыл бұрын
@@SamFromaway hi in the end i pushed everthing into an array see code below was just that some parts differ tryed it with complete diffrent locations that also works but often causes a stack overflow const { src, series, dest, watch, } = require('gulp'); const sass = require("gulp-sass") const { init, reload, stream } = require("browser-sync"); const paths = ["./Content/styles/login.scss", "./Content/styles/main.scss", "./Content/styles/external/*.scss", "./Content/styles/impressum.scss", "./Content/styles/shared/**/*.scss", "./Content/styles/shared/*.scss", "./Areas/**/Content/styles/*.scss", ]; function sassCompile() { return src(paths, { base: "./" }) .pipe(sass()) .pipe(dest(".")) .pipe(stream()); } function watchTask() { init({ server: { baseDir: "./", }, }); watch(paths, sassCompile).on("change", reload); } exports.sassCompile = sassCompile; exports.watchTask = watchTask; exports.default = series(sassCompile, watch);
@SamFromaway
@SamFromaway 4 жыл бұрын
@@VileEnd Perfect, thanks for letting me know :D
@VileEnd
@VileEnd 4 жыл бұрын
@@SamFromaway np ^^
@tejaskesaria7175
@tejaskesaria7175 4 жыл бұрын
can you please tell me the difference between gulp and webpack?
@SamFromaway
@SamFromaway 4 жыл бұрын
Good question. They are similar but webpack is surely more advanced than Gulp, whereas Gulp is easier to configure. Wepack also has a bigger ecosystem with plugins etc. For simple tasks I would use Gulp, for bigger tasks either configure webpack, but usually if you have to configure webpack there is probably a template out there for your use-case like create-react-app etc
@tharakakarunarathne2420
@tharakakarunarathne2420 4 жыл бұрын
I get an error. Please help "Did you forget to signal async completion?"
@someone761
@someone761 3 жыл бұрын
gulp wait for return to signal completion of the task async function and there're many ways for this ... read gulpjs.com/docs/en/getting-started/async-completion but simply you can add "async" before your task function for now .
@aurelianspodarec2629
@aurelianspodarec2629 4 жыл бұрын
What about Scss?
@SamFromaway
@SamFromaway 4 жыл бұрын
You find how to compile scss in their documentation too
@someone761
@someone761 3 жыл бұрын
I got this error PostCSS plugin autoprefixer requires PostCSS 8. Migration guide for end-users: github.com/postcss/postcss/wiki/PostCSS-8-for-end-users tried many things and nothing works!!!!!!!!
@korkut31
@korkut31 Жыл бұрын
:) bad tutor. why did not u use inject at the end ? funny :) terser is uselless at 2023 cosa need a module bundler
@jasonflaherty6186
@jasonflaherty6186 2 жыл бұрын
for imagemin, i had to use: npm i gulp-imagemin@7.1.0
Gulpfile Setup-Automate and Enhance Your Code
15:27
Treehouse
Рет қаралды 9 М.
Learn Webpack Pt. 10: Extract CSS & Minify HTML/CSS/JS
18:18
Colt Steele
Рет қаралды 43 М.
НИКИТА ПОДСТАВИЛ ДЖОНИ 😡
01:00
HOOOTDOGS
Рет қаралды 2,1 МЛН
Good teacher wows kids with practical examples #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 13 МЛН
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 11 МЛН
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 19 МЛН
Grunt, Gulp, Npm, Webpack and when to use what
19:55
Fredrik Christenson
Рет қаралды 26 М.
10 CSS Pro Tips - Code this, NOT that!
9:39
Fireship
Рет қаралды 2,2 МЛН
10 modern layouts in 1 line of CSS
21:39
Chrome for Developers
Рет қаралды 1,1 МЛН
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
Browsersync + Sass + Gulp in 15 minutes
15:02
Coder Coder
Рет қаралды 48 М.
What’s Up with Laravel? It’s Everywhere, and Here’s Why!
6:22
Новый CSS! 2024
18:06
Как пройти в IT?
Рет қаралды 24 М.
You might not need useEffect() ...
21:45
Academind
Рет қаралды 164 М.
НИКИТА ПОДСТАВИЛ ДЖОНИ 😡
01:00
HOOOTDOGS
Рет қаралды 2,1 МЛН