ラベル Prettier の投稿を表示しています。 すべての投稿を表示
ラベル Prettier の投稿を表示しています。 すべての投稿を表示

2022年12月4日日曜日

AlmaLinux 9/Rocky Linux 9にPrettierをインストールする

PrettierでJavascriptやHTMLなどのコードを整形する事ができます。

インストール手順

以下のコマンドを実行します。
# install node.js
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -

sudo dnf -y install nodejs

# install yarn
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

sudo yum -y install yarn

# install prettier
sudo yarn global add prettier

テスト実行

$ echo '<!DOCTYPE html><html lang="ja"><head><meta charset="UTF-8"><title>sample</title></head><body>サンプル</body></html>' | prettier --stdin-filepath test.html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="UTF-8" />
    <title>sample</title>
  </head>
  <body>
    サンプル
  </body>
</html>

関連情報

・プロジェクトgithubリポジトリ
https://github.com/prettier/prettier

2021年8月8日日曜日

Rocky Linux 8.4にPrettierをインストールする

PrettierでJavascriptやHTMLなどのコードを整形する事ができます。

インストール手順

以下のコマンドを実行します。
# install node.js
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -

sudo dnf -y install nodejs

# install yarn
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

sudo yum -y install yarn

# install prettier
sudo yarn global add prettier

テスト実行

以下のようなコマンドでHTMLを整形する事ができます。
$ echo '<!DOCTYPE html><html lang="ja"><head><meta charset="UTF-8"><title>sample</title></head><body>サンプル</body></html>' | prettier --stdin-filepath test.html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="UTF-8" />
    <title>sample</title>
  </head>
  <body>
    サンプル
  </body>
</html>

関連情報

・プロジェクトgithubリポジトリ
https://github.com/prettier/prettier

2021年5月6日木曜日

AlmaLinux8.3にPrettierをインストールする

PrettierでJavascriptやHTMLなどのコードを整形する事ができます。

インストール手順

以下のコマンドを実行します。
# install node.js
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -

sudo dnf -y install nodejs

# install yarn
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

sudo yum -y install yarn

# install prettier
sudo yarn global add prettier

テスト実行

以下のコマンドでテスト実行を行います。
$ echo '<!DOCTYPE html><html lang="ja"><head><meta charset="UTF-8"><title>sample</title></head><body>sample</body></html>' | prettier --stdin-filepath test.html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="UTF-8" />
    <title>sample</title>
  </head>
  <body>
    sample
  </body>
</html>

関連情報

・プロジェクトgithubリポジトリ
https://github.com/prettier/prettier

2020年12月29日火曜日

CentOS 8-StreamにPrettierをインストールする

PrettierでJavascriptやHTMLなどのコードを整形する事ができます。

インストール手順

以下のコマンドを実行します。
# install node.js
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -

sudo dnf -y install nodejs

# install yarn
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

sudo yum -y install yarn

# install prettier
sudo yarn global add prettier

テスト実行

$ echo '<!DOCTYPE html><html lang="ja"><head><meta charset="UTF-8"><title>sample</title></head><body>sample</body></html>' | prettier --stdin-filepath test.html <!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8" /> <title>sample</title> </head> <body> sample </body> </html>

関連情報

・プロジェクトgithubリポジトリ
https://github.com/prettier/prettier

2020年7月26日日曜日

CentOS 8.1にPrettierをインストールする

PrettierでJavascriptやHTMLなどのコードを整形する事ができます。

〇インストール手順
以下のコマンドを実行します。
# install node.js
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -

sudo dnf -y install nodejs

# install yarn
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

sudo yum -y install yarn

# install prettier
sudo yarn global add prettier

〇テスト実行
$ echo '<!DOCTYPE html><html lang="ja"><head><meta charset="UTF-8"><title>sample</title></head><body>sample</body></html>' | prettier --stdin-filepath test.html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="UTF-8" />
    <title>sample</title>
  </head>
  <body>
    sample
  </body>
</html>

〇関連情報
・プロジェクトgithubリポジトリ
https://github.com/prettier/prettier

2020年6月10日水曜日

Raspberry Pi(Raspbian Buster)/Debian 10(Buster)/Ubuntu 20.04にPrettierをインストールする

PrettierでJavascriptやHTMLなどのコードを整形する事ができます。

〇インストール手順
以下のコマンドを実行します。
# install node.js
sudo apt-get -y install curl

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

sudo apt-get install -y nodejs

# install yarn
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update && sudo apt-get -y install yarn

# install prettier
sudo yarn global add prettier

〇テスト実行
$ echo '<!DOCTYPE html><html lang="ja"><head><meta charset="UTF-8"><title>sample</title></head><body>sample</body></html>' | prettier --stdin-filepath test.html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="UTF-8" />
    <title>sample</title>
  </head>
  <body>
    sample
  </body>
</html>

〇動作確認環境
・Raspbian Buster
・Debian 10(Buster)
・Ubuntu 20.04

〇関連情報
・プロジェクトgithubリポジトリ
https://github.com/prettier/prettier