Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTony Brackins
28,766 PointsAfter running server, I don't see app.js
After running gulp concatScripts and running the server, I don't see app.js when I view the source of the web page, however, in the directory, I do see app.js.
Here's my gulp.js:
'use strict'; //causes nodefile to go strict
var gulp = require('gulp'),
concat = require('gulp-concat');
gulp.task("concatScripts", function() {
gulp.src([
'js/jquery.js',
'js/sticky/jquery.sticky.js',
'js/main.js'])
.pipe(concat("app.js"))
.pipe(gulp.dest("js"))
});
gulp.task("default", ["hello"], function(){
console.log("This is the default task!");
});
7 Answers
Iain Simmons
Treehouse Moderator 32,305 PointsDon't forget to update index.html
to only load js/app.js
and not the three individual files.
Oh and you'll need to stop and restart the http-server
to see the changes, and potentially clear your browser's cache and refresh the page.
Tony Brackins
28,766 Pointsgulp concatScripts. It actually worked, but is not reflecting when I launch the server.
Jonathan Grieve
Treehouse Moderator 91,253 PointsJust catching up on this course and it is the same for me. I don't get an app.js but i can see that the jquery is working and I know an app.js file exists.
Michael Johnson
6,340 PointsIs anyone ever going to answer this ?
George Matthews
8,029 PointsI know this has been a long time since this was opened but i'm doing this course and I don't see the app.js file in my folders either. When I run the server on 3000 it works and I inspect and see the app.js is there but in the folder on my computer there is no app.js.
Any ideas?
steven alston
16,292 PointsOne of the first things he did was to delete the 3 js files and add just the app.js to the footer of the index.html file.
steven alston
16,292 PointsI know this is a little older of a post, but the first thing he did was to delete the 3 js files and add just the app.js to the footer of the index.html file.
Jose Figueroa
16,781 PointsThis is the code that worked for me. Hope it helps.
"use strict";
let gulp = require("gulp");
let concat = require('gulp-concat');
gulp.task("concatScripts", function(done) {
gulp.src([
"js/jquery.js",
"js/sticky/jquery.sticky.js",
"js/main.js"])
.pipe(concat("app.js"))
.pipe(gulp.dest("js"));
done();
});
gulp.task("default", gulp.parallel("concatScripts"), function() {
console.log("This is the default task!");
});
Chad Donohue
5,657 PointsIt looks as if your 'default' task isn't calling your 'concatScripts' task.
I think your default task should look like the following:
gulp.task('default', ['concatScripts'], function() {
console.log('This is the default task!');
});
Tony Brackins
28,766 PointsIn the video, the default task is as above. :/
Chad Donohue
5,657 PointsHow are you calling the task from the command line?
Are you just typing gulp
?
If so, then that will just run the default
task.
You can either specify a task after the gulp
command,
or set it as a dependency in the default
gulp task
> gulp // runs default task
> gulp concatScripts // runs concatScripts
Iain Simmons
Treehouse Moderator 32,305 PointsIain Simmons
Treehouse Moderator 32,305 PointsHi Tony B, just letting you know I wrapped your code in a code block with syntax highlighting.