Skip to content

Instantly share code, notes, and snippets.

@terrierscript
Last active January 16, 2016 12:36
Show Gist options
  • Save terrierscript/b8087c111183979bd55f to your computer and use it in GitHub Desktop.
Save terrierscript/b8087c111183979bd55f to your computer and use it in GitHub Desktop.
SourcemapをRequest Headerから指定させて捗らせる話 ref: http://qiita.com/inuscript/items/eec749c3ba00eb8ac693
X-SourceMap: /path/to/script.js.map
<IfModule mod_rewrite.c>
RewriteEngine On
# source map
RewriteCond %{REQUEST_URI} ^(.+\.(css|js))$
RewriteCond %{DOCUMENT_ROOT}%1.map -f
RewriteRule . - [L,E=SOURCE_MAP:%{REQUEST_URI}.map?%{QUERY_STRING}]
Header set X-SourceMap "%{SOURCE_MAP}e" env=SOURCE_MAP
</IfModule>
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('sass', function () {
gulp.src(pathToSrcSass)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write("./", {addComment: false, debug:true}))
.pipe(gulp.dest(pathToOutputSass))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment