Download the PHP package visuellverstehen/statamic-sourcestack without Composer

On this page you can find all versions of the php package visuellverstehen/statamic-sourcestack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-sourcestack

SourceStack

A Statamic utility to only include css/js sources once. This can be useful when you want to include dedicated files for specific partials/sets that would otherwise be included multiple times within a template.

Assume a basic Statamic blueprint with a replicator field pagebuilder that stacks sets in a template:

Further assume that there is an 'image' and a 'gallery' set, which both require dedicated javascript source files:

By using the once tag we try make sure to only include every source once. The scripts stack is rendered in the layout.

However, if you add both an image and a gallery in a page, the lightbox.js script file will be added twice. The stack has no way to determine if a file was already added or not.

This is where SourceStack comes in.

How to Install

Run the following command from your project root:

How to Use

Let's modify the Statamic setup described above. Instead of using the scripts stack for our js source, we use the sourcestack tag included in this package:

The tag collects all the sources throughout the template, making sure to add every source only once. Eventually, the sourcestack:render tag renders all collected sources as a vite source tag.

You can also use the tag alias srcstk. Sources can be added with the src, source or file parameter. Output can be generated with render or vite.

Like in a vite tag you can add multiple sources at once. Files must be separated by either a comma (,) or a pipe (|):

Dedicated stacks

If you need multiple stacks for different sources, you can define dedicated stacks in the config file:

For each stack you can optionally define a base directory and a file extension. Assuming the example above, the tag would be used like this:

Please note that stacks can't be called render or any other strings that resolve to public function names of the Sourcestack tag class.

Caveats

The way SourceStack is currently built requires the output to be called after all sources have been collected. You can however use Statamics section and yield logic to move e. g. a stack with css files to the <head> element:

Configuration

In addition to dedicated stacks (see above), you can configure the default base directory to be used for all regular source file paths in config/sourcestack.php.

More about us

License

The MIT license (MIT). Please take a look at the license file for more information.


All versions of statamic-sourcestack with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
statamic/cms Version ^4.0 || ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package visuellverstehen/statamic-sourcestack contains the following files

Loading the files please wait ....