Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

fix(build): fix sourcemap logic #1541

Merged
merged 1 commit into from
Mar 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,15 @@ gulp.task('scripts', ['clean'], function() {

gulp.task('styles', ['clean'], function() {

return gulp.src('src/common.css')
return gulp.src(['src/common.css'], {base: 'src'})
.pipe($.sourcemaps.init())
.pipe($.header(config.banner, {
timestamp: (new Date()).toISOString(), pkg: config.pkg
}))
.pipe($.concat('select.css'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wesleycho I've had to restore this line locally to get select.css saved to dist, are you sure it should have been removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary to have sourcemaps unless it's minified, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think what you're saying is correct, double negatives and all 👀

We are always minifying though, I think the maps are generated fine but the unminified css isn't saved to dist.

With:

  return gulp.src(['src/common.css'], {base: 'src'})
    .pipe($.sourcemaps.init())
    .pipe($.header(config.banner, {
      timestamp: (new Date()).toISOString(), pkg: config.pkg
    }))
    .pipe($.concat('select.css'))
    .pipe(gulp.dest('dist'))
    .pipe($.minifyCss())
    .pipe($.concat('select.min.css'))
    .pipe($.sourcemaps.write('../dist', {debug: true}))
    .pipe(gulp.dest('dist'));

I get

  - select.min.css
  - select.min.css.map
  - select.min.js
  - select.min.js.map
  - select.css
  - select.js

With:

 return gulp.src(['src/common.css'], {base: 'src'})
    .pipe($.sourcemaps.init())
    .pipe($.header(config.banner, {
      timestamp: (new Date()).toISOString(), pkg: config.pkg
    }))
    .pipe($.concat('select.css'))
    //.pipe(gulp.dest('dist'))
    .pipe($.minifyCss())
    .pipe($.concat('select.min.css'))
    .pipe($.sourcemaps.write('../dist', {debug: true}))
    .pipe(gulp.dest('dist'));

I get:

  - select.min.css
  - select.min.css.map
  - select.min.js
  - select.min.js.map
  - select.js

Note the missing select.css, easy enough to fix just wanted to be sure I was doing it right.

.pipe(gulp.dest('dist'))
.pipe($.sourcemaps.init())
.pipe($.minifyCss())
.pipe($.concat('select.min.css'))
.pipe($.sourcemaps.write('./', {debug: true}))
.pipe($.sourcemaps.write('../dist', {debug: true}))
.pipe(gulp.dest('dist'));

});
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,25 @@
"conventional-recommended-bump": "0.0.3",
"del": "~0.1.1",
"event-stream": "~3.1.0",
"gulp": "~3.8.5",
"gulp-angular-templatecache": "~1.2.1",
"gulp": "^3.9.1",
"gulp-angular-templatecache": "^1.8.0",
"gulp-bump": "^1.0.0",
"gulp-conventional-changelog": "^0.7.0",
"gulp-concat": "^2.6.0",
"gulp-git": "^1.4.0",
"gulp-header": "~1.0.2",
"gulp-footer": "~1.0.5",
"gulp-jshint": "1.6.4",
"gulp-header": "^1.7.1",
"gulp-footer": "^1.0.5",
"gulp-jshint": "^2.0.0",
"gulp-load-plugins": "^1.1.0",
"gulp-minify-css": "~0.3.6",
"gulp-minify-html": "~0.1.0",
"gulp-minify-css": "^1.2.4",
"gulp-minify-html": "^1.0.6",
"gulp-plumber": "^0.6.3",
"gulp-sourcemaps": "^1.6.0",
"gulp-tag-version": "^1.3.0",
"gulp-uglify": "~0.3.1",
"gulp-uglify": "^1.5.3",
"gulp-util": "^2.2.19",
"jquery": "~1.11",
"jshint": "^2.9.1",
"jshint-stylish": "~0.3.0",
"karma": "^0.12.16",
"karma-chrome-launcher": "^0.1.3",
Expand Down