最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sprockets - How to include javascript in middleman 4? - Stack Overflow

programmeradmin2浏览0评论

I've been using Middleman for a while and it always used the Rails asset pipeline for including javascript and css. So to include a javascript module called "thing.js" in the same directory, you'd do:

//= require thing

But since Middleman 4, that seems to have changed and I can't find any documentation. The closest thing I can find is this page which shows me how to run an ember.js pilation: /

So... if I want to load javascript files in Middleman now, do I have to roll my own build system? Or am I missing something?

I've been using Middleman for a while and it always used the Rails asset pipeline for including javascript and css. So to include a javascript module called "thing.js" in the same directory, you'd do:

//= require thing

But since Middleman 4, that seems to have changed and I can't find any documentation. The closest thing I can find is this page which shows me how to run an ember.js pilation: https://middlemanapp./advanced/external-pipeline/

So... if I want to load javascript files in Middleman now, do I have to roll my own build system? Or am I missing something?

Share Improve this question edited Mar 21, 2016 at 4:51 David Silva Smith 11.7k11 gold badges69 silver badges93 bronze badges asked Feb 10, 2016 at 11:30 straffarenstraffaren 3375 silver badges10 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

The easy answer was to include the middleman-sprockets gem. That way things will work like they used to.

Add this to your gemfile

gem 'middleman-sprockets', '~> 4.0.0.rc.1' 

Run bundle install.

You don't need to activate anything, the middleman-sprockets extension auto-activates

发布评论

评论列表(0)

  1. 暂无评论