• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

craigmdennis/middleman-gulp-starter: Middleman + Gulp Starter = Static Site Awes ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

craigmdennis/middleman-gulp-starter

开源软件地址(OpenSource Url):

https://github.com/craigmdennis/middleman-gulp-starter

开源编程语言(OpenSource Language):

JavaScript 61.2%

开源软件介绍(OpenSource Introduction):

Middleman + Gulp Starter

Build static sites using Middleman with Gulp Starter.

Watch the screencast: https://youtu.be/-io8EeB3GHI

Installation

  1. Clone the repo — git clone [email protected]:craigmdennis/middleman-gulp-starter.git
  2. Run setup — bin/setup

Setup installs Bundler, Gem dependencies and NPM dependencies.

Developing using Middleman + Gulp Starter

  1. Run middleman serve to use the environments/development config

Middleman will launch Gulp Starter as an external pipeline, in development mode.

Production builds

  1. Run middleman build to use the environments/production config

Middleman will minify HTML and Gulp starter will handle everything else

Running Middleman without Gulp Starter

There may be instances where you want to run the standard Middleman tasks without initiating Gulp Starter. To do that you simply need to pass in another environment. It doesn't even need to exist.

middleman serve -e debug

Now you can create environments/debug and add your own custom config in there.

Revving Assets

You'll no longer be able to use the built in Middleman asset helpers like javascript_include_tag on their own. Instead, you'll have to add a set of gulp_asset_helpers. Filenames get hashed so you can cache them forever. Learn more

gulp_asset_path('image/asset.jpg') # -> /image/logo-n39o4orb81.png
gulp_js_path('app.js')             # -> /javascripts/app-f43e9abc11.js
gulp_css_path('app.css')           # -> /stylesheets/app-d29e4cdb76.css
gulp_image_path('logo.png')        # -> /images/logo-n39o4orb81.png

So instead of this:

<%= image_tag 'logo.png', alt: 'logo' %>

You would do this:

<%= image_tag gulp_image_path('logo.png'), alt: 'logo' %>

Instead of this:

<%= stylesheet_link_tag :site %>

You would do this:

<%= stylesheet_link_tag gulp_css_path('site.css') %>

When NOT to use the gulp_asset_path helpers

Due to the way that Middleman merges the temporary folder with the source folder in the sitemap, when you reference it you don't need to use the gulp_image_path helper as the files in the sitemap will already be the revved files.

- sitemap.resources.select{ |r| r.path.start_with?("images/some-folder-of-images") }.each do |image|
    = image_tag image.path

You can disable asset revving in production on the config.json at the bottom.

Contributing

Please make sure to submit PRs to the latest feature branch.

Release History

Please consult the official changelog




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
rogeriopvl/gulp-jsonlint: 发布时间:2022-06-21
下一篇:
karimsa/gulp-jslint: JSLint for gulp.js.发布时间:2022-06-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap