CentOS7でFuelPHPでlessを使う

最終更新日

 

FuelPHPでLESSを使えるようにする
を参考にFuelPHPでlessを実装してみる。

一通りの設定を終えたところで

エラーがは発生

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

ということで、ライブラリをインストールします。

# yum install ld-linux.so.2

さらにエラー

node: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

よくわかなんないが、libstdc++.so.6というのが開けないということなので
これもインストールします。

yumでインストールしたいのですが
パッケージ名がわからないので、whatprovidesを使います

# yum whatprovides libstdc++.so.6
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: centosv4.centos.org
 * updates: centosv4.centos.org
libstdc++-4.8.5-16.el7.i686 : GNU Standard C++ Library
Repo        : base
Matched from:
Provides    : libstdc++.so.6



libstdc++-4.8.5-16.el7_4.1.i686 : GNU Standard C++ Library
Repo        : updates
Matched from:
Provides    : libstdc++.so.6



libstdc++-4.8.5-16.el7_4.2.i686 : GNU Standard C++ Library
Repo        : updates
Matched from:
Provides    : libstdc++.so.6

私の環境では、最後の
libstdc++-4.8.5-16.el7_4.2.i686
がインストールできた。

# yum install libstdc++-4.8.5-16.el7.i686

ここで無事lessがccssにコンパイルされました。

最終的には、Viewで

echo Asset::less('test.less');

をしないといけないんですが、
ViewはSmartyを使っているので、
Viewファイルに直接上記のコードが書けない。

そのため、Controllerでlessをコンパイルしたスタイルシートのタグを
Viewに変数として渡し、そいつを表示する

Controller側

$view = \View_Smarty::forge('index');
$view->set_safe('css', Asset::less('test.less'));

index.tpl側

{$css}

masa