1
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 5 years have passed since last update.

laravel55 + Polymer環境構築

1
Posted at

laravel55 + Polymer環境構築

PolymerをBowerを使ってインストールするために、.bowerrcファイルをプロジェクトルートに作成します。

{
  "directory": "resources/assets/bower_components",
  "json": "bower.json"
}

bower initを実行して、bower.jsonを作ります。

$ bower init

bower installを実行して、Polymerをインストールします。

$ bower install --save Polymer/polymer 

Laravel mixより、publicディレクトリにbower_componentsディレクトリがコピーされるように修正します。参考
Laravel mixの設定は、webpack.mix.jsに追記します

...

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css')
   .copyDirectory('resources/assets/bower_components', 'public/bower_components');

...

index.blade.phpなどのHTMLのheaderにwebcomponentsのポリフィルと、Polymerを読み込みます。

...
    <script src="/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
    <link rel="import" href="/bower_components/polymer/polymer.html">
...
1
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
1
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?