Exemple #1
0
 /**
  * Register inline code.
  *
  * @param Asset $asset
  */
 protected function registerInline(Asset $asset)
 {
     $args = $asset->getArgs();
     if (empty($args) || !isset($args['inline'])) {
         return;
     }
     // Process if there are inline codes.
     $inlines = $args['inline'];
     foreach ($inlines as $inline) {
         if ('script' === $asset->getType()) {
             wp_add_inline_script($args['handle'], $inline['data'], $inline['position']);
         } elseif ('style' === $asset->getType()) {
             wp_add_inline_style($args['handle'], $inline['data']);
         }
     }
 }
Exemple #2
0
 /**
  * Register a 'style' asset.
  *
  * @param Asset $asset
  * @return void
  */
 protected function registerStyle(Asset $asset)
 {
     $args = $asset->getArgs();
     $media = is_string($args['mixed']) ? $args['mixed'] : 'all';
     $version = is_string($args['version']) ? $args['version'] : false;
     wp_enqueue_style($args['handle'], $args['path'], $args['deps'], $version, $media);
 }
 public function loop()
 {
     Asset::add('masonry', 'js/masonry.pkgd.min.js', false, '1.0', false, 'script');
     return View::make('partials.product.loop', ['posts' => PostModel::all()])->render();
 }