LoginSignup
3
2

More than 5 years have passed since last update.

chromelessを日本語対応するよ!

Posted at

はじめに

headless chrome を lambda で動かすにあたって日本語化に躓いたので、対応法をば。
chromelessかどうかにかかわらず、lambdaで日本語扱うなら同じような感じで対応可能かも?
フォントの入っている .fonts ディレクトリの作成と、HOME環境変数の設定でいけそう。

手順


chromelessをインストールする

$ git clone https://github.com/graphcool/chromeless.git
$ cd chromeless/serverless
$ npm install

.fonts ディレクトリを作成してNotoSans入れる

mkdir .fonts
$ cd .fonts
$ wget https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCJKjp-hinted.zip
$ unzip NotoSansCJKjp-hinted.zip
$ find . -not -iname "*.otf" -type f -delete

serverless.ymlを編集 (Diff)

serverless.yml
2a3,6
 package:
   include:
     - .fonts/*

57a62
       HOME: /var/task

デプロイ

$ npm run deploy

※ 要Credentials, IoT Endpointの設定

参考

Github Issue
https://github.com/adieuadieu/serverless-chrome/issues/49#issuecomment-377342836)

3
2
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
3
2