public function create(\Closure $closure)
    {
        ob_start();
        echo '/*GENERATED AT '.date('Y-m-d H:i:s').'*/';
        $closure();
        $content = ob_get_clean();

        // trim empty spaces and strip only script/style tags.
        $content = trim(preg_replace('/<\/?' . $this->getTypeTag() . '(.|\s)*?>/', '', $content));

        $dirs = explode(DIRECTORY_SEPARATOR, $this->filepath);

        array_pop($dirs);

        $dirs = implode(DIRECTORY_SEPARATOR, $dirs);

        if(!is_dir($dirs))
            mkdir($dirs, '755', true);

        // keep replacing those content
        $this->persist($content);

        return $this;
    }
public function create(\Closure $closure)
    {
        ob_start();
        echo '/*GENERATED AT '.date('Y-m-d H:i:s').'*/';
        $closure();
        $content = ob_get_clean();

        // trim empty spaces and strip only script/style tags.
        $content = trim(preg_replace('/<\/?' . $this->getTypeTag() . '(.|\s)*?>/', '', $content));

        $dirs = explode(DIRECTORY_SEPARATOR, $this->filepath);

        array_pop($dirs);

        $dirs = implode(DIRECTORY_SEPARATOR, $dirs);

        if(!is_dir($dirs))
            mkdir($dirs, '755', true);

        // keep replacing those content
        $this->persist($content);

        return $this;
    }
public function create ( \ Closure $ closure ) { ob_start ( ) ; echo '/*GENERATED AT ' . date ( 'Y-m-d H:i:s' ) . '*/' ; $ closure ( ) ; $ content = ob_get_clean ( ) ; // trim empty spaces and strip only script/style tags. $ content = trim ( preg_replace ( '/<\/?' . $ this -> getTypeTag ( ) . '(.|\s)*?>/' , '' , $ content ) ) ; $ dirs = explode ( DIRECTORY_SEPARATOR , $ this -> filepath ) ; array_pop ( $ dirs ) ; $ dirs = implode ( DIRECTORY_SEPARATOR , $ dirs ) ; if ( ! is_dir ( $ dirs ) ) mkdir ( $ dirs , '755' , true ) ; // keep replacing those content $ this -> persist ( $ content ) ; return $ this ; }
Create an asset with the given closure to be buffered.
@param \Closure
Create an asset with the given closure to be buffered .