Created
August 6, 2015 09:26
-
-
Save uiur/7424453392a2e594f279 to your computer and use it in GitHub Desktop.
reworkでrails asset-url 問題をなんとかする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs = require('fs') | |
module.exports = | |
manifest: -> | |
JSON.parse(fs.readFileSync(__dirname + '/../../../tmp/manifest.json', 'utf8')) | |
url: (path) -> | |
@manifest()[path] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reworkFunction = require('rework-plugin-function') | |
asset = require('./asset.coffee') | |
reworkAssetUrl = -> | |
asset.env = env.name or 'development' | |
reworkFunction('asset-url': (path) -> | |
"url('#{asset.url(path)}')" | |
) | |
gulp.task 'build:css', -> | |
gulp.src("application.scss") | |
.pipe(sass(includePaths: [baseDir, 'bower_components/'])) | |
.pipe(rework(reworkAssetUrl())) | |
.pipe(gulp.dest(config.assets.dir)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment