2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【解決方法】middlemanでCSS(スタイル)が適用されない

Last updated at Posted at 2021-09-20

問題点

middlemanのバージョンを上げて新しいプロジェクトを作成したところ、CSS(スタイル)が適用されなくなった

準備

  1. 最新のmiddleman(v4.4)をインストール

手順

  1. 新しいプロジェクトを作成(middleman init
  2. サーバ起動(middleman server
  3. ブラウザで表示確認

結果

  • CSS(スタイル)が適用されない
  • コンソールにエラーが表示される(TypeError: Cannot read property 'version' of undefined
スクリーンショット 2021-09-20 13.49.43.png

解決方法

Gemfileでmiddleman-autoprefixerのバージョン指定を「3.0」以上にする

修正内容

Gemfile
source 'https://rubygems.org'

gem 'middleman', '~> 4.2'
- gem 'middleman-autoprefixer', '~> 2.7'
+ gem 'middleman-autoprefixer', '~> 3.0'
gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby, :x64_mingw]
gem 'wdm', '~> 0.1', platforms: [:mswin, :mingw, :x64_mingw]
# バージョンを更新したgemをインストール
$ bundle install

# サーバ起動
$ middleman server
スクリーンショット 2021-09-20 13.49.39.png

参考

css 404 error after build · Issue #2463 · middleman/middleman

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?