Download the PHP package sunnysideup/sswebpack_engine_only without Composer

On this page you can find all versions of the php package sunnysideup/sswebpack_engine_only. 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 sswebpack_engine_only

Independent Webpack Build System

A drop-in webpack build engine for SilverStripe that can compile the front-end assets of any theme or vendor package from one place.

It is powered by Symfony Encore.


Requirements


Installation

  1. Install this module into your themes/ folder as sswebpack_engine_only (Composer does this automatically).

  2. Create the front-end files for your theme — see the examples-from-root-of-project folder for the exact files you need.

  3. Expose your theme's dist folder in the public resources folder via Composer, as usual.

  4. Install dependencies:

Tip: add an alias so you can just type webpack … from your project root:

The examples below assume you have done this. Always run it from the base folder of your project.


Usage

Command What it does
install Install engine deps and the theme's project modules
hot Dev build served with hot reloading (CSS hot-injection)
watch Dev build, rebuilt on every save (to disk, no browser integration)
build Production build

theme-dir is optional (you can also give it with -t). If omitted, the first folder under ./themes/ that contains src/main.js is used (the engine folder is skipped). A theme can live anywhere:

Options

Options are ordinary flags — the helper translates them into the environment variables the config reads.

Flag Default Purpose
-t, --theme DIR auto-detect Theme directory (same as the positional)
-j, --js FILE src/main.js JS entry point
-c, --css FILE src/style.scss CSS entry point
-e, --editor FILE src/editor.scss Editor (TinyMCE) CSS entry point
-d, --dist DIR <theme>/dist Output folder
-n, --node-dir DIR <theme>/my_node_modules Extra node_modules location
--jquery / --no-jquery excluded Include / exclude jQuery in the bundle
-h, --help Show help

hot-only flags:

Flag Default Purpose
--no-hmr HMR on Full page reload instead of CSS hot-inject
--host HOST localhost dev-server host
--port PORT 8080 dev-server port
--public-path PATH /_resources/<dist> URL path the dist is served at
--ws-url URL derived from SS_BASE_URL HMR socket URL (see hot reloading, below)

Example:

Calling npm directly (advanced)

If you bypass the helper, run npm from inside the engine folder and pass the theme as an environment variable, not a flag:

Every flag above has a matching WEBPACK_* variable (--css → WEBPACK_CSS_FILE, --no-jquery → WEBPACK_INCLUDE_JQUERY=no, and so on).


Hot reloading (webpack hot)

hot runs the Encore dev-server with CSS hot-injection: save a .scss file and the styles update in the browser with no page reload.

The nice part: your template includes stay identical to production. The dev-server writes its bundles to disk at your theme's dist/ path, so SilverStripe serves the JS/CSS (and the hot-update chunks) from /_resources/… exactly as it does in production. The only thing that needs the dev-server is a small notification socket — and that is routed through your own domain, so no localhost:8080 ever appears in a URL.

One-time Apache setup

The helper reads SS_BASE_URL from your project's .env and derives the socket URL automatically (http://… → ws://…/ws, https://… → wss://…/ws). You just forward /ws to the dev-server. Add these two lines inside your site's <VirtualHost> block:

Enable the proxy modules once and restart:

Then just run:

Because the socket uses the same scheme and domain as your page, an https dev site works too (it becomes wss://…) — no mixed-content problem.

The one caveat: main.css

While hot runs with HMR on, the CSS is injected from the JS and no main.css file is emitted, so that one <link> 404s (harmless, with a brief flash of unstyled content on first paint). Two ways to handle it:

Simplest fallback: watch

If you would rather not touch Apache at all, webpack watch writes the real runtime.js, app.js, and main.css to dist/ on every save. Your production links already point there — just refresh the browser yourself. No dev-server, no port, no socket, no template change.


Good to know

Required structure

Your theme name can be anything (mytheme is just an example), and this works on vendor packages too. Each buildable theme needs:

jQuery

Editor file

There is an option to compile a separate editor stylesheet (src/editor.scss) for your TinyMCE HTML editor. Run any build command and the report at the top of the output shows which entry points were picked up.

Including the build files in your templates

Two options:

  1. Automatically — add sunnysideup/webpack_requirements_backend via Composer and follow its docs to inject the required files.

  2. Manually — reference the compiled files from the exposed dist folder:

    runtime.js is required in production too (it holds webpack's bootstrap from enableSingleRuntimeChunk), and must load before app.js. See the hot reloading section for the main.css note during webpack hot.


All versions of sswebpack_engine_only with dependencies

PHP Build Version
Package Version
No informations.
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 sunnysideup/sswebpack_engine_only contains the following files

Loading the files please wait ...