Skip to content

Instantly share code, notes, and snippets.

@uiur
Created August 6, 2015 09:26
Show Gist options
  • Save uiur/7424453392a2e594f279 to your computer and use it in GitHub Desktop.
Save uiur/7424453392a2e594f279 to your computer and use it in GitHub Desktop.
reworkでrails asset-url 問題をなんとかする
fs = require('fs')
module.exports =
manifest: ->
JSON.parse(fs.readFileSync(__dirname + '/../../../tmp/manifest.json', 'utf8'))
url: (path) ->
@manifest()[path]
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