Re: Gulp: Work in progress, newbie needs support please
Posted: Thu Aug 13, 2015 12:22 pm
If you're looking at further improving load times, take a look at this http://betterexplained.com/articles/how ... mpression/
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Does this happen with CSS too?No. Minifying it would actually use more space as you'd have two copies of the file; one minified, one not.
Yes. Have one directory for human-readable, easily editable files, and one containing the minified versions that you actually use in your site.simonmlewis wrote:So what do I do with the contents of my dist folder?
So I use those files, instead of the current CSS files?
You don't need to. Doesn't really matter one way or the other. What's important is that the client be pulling down the minified files.simonmlewis wrote:As the way I read you rmessage, I have to upload BOTH files for some reason.
Rightsimonmlewis wrote:So locally, I run Gulp which minifies CSS and JS
I suppose, if you like. Personally, I'd just edit site.js and set my script src to site.min.js and so forth.simonmlewis wrote:and I edit Gulp first I guess to make sure it uses the same filenames too! (easier).
No, the minified files are measurably smaller. A space is still a character, as is a tab.simonmlewis wrote:Thus not specifically reducing file sizes, but because there is less to "read" in the files, they take less time to load.
No. Keep your files legible. You're going to need to go back and edit them. As I have already stated, minifying PHP will yield precisely zero benefit. Set up Gzip compression in Apache if you want to reduce the size of what's being sent over the wire.simonmlewis wrote:I suppose to do a "manual" version of this minifying, I should reduce the white space where poss in my index.php file and others.
Code: Select all
// Concatenate & Minify JS
gulp.task('scripts', function() {
return gulp.src('js/*.js')
.pipe(concat('all.js'))
.pipe(gulp.dest('dist'))
.pipe(rename('all.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});Yes, that's right.simonmlewis wrote:reading the gulp file, it's all.min.js.