Skip to content

Commit

Permalink
Merge pull request #125 from StrykeSlammerII/patch-2
Browse files Browse the repository at this point in the history
Chapter 6 proofreading
  • Loading branch information
lcharette authored Jan 12, 2024
2 parents b9bdded + 758f3d4 commit 13fca6a
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 87 deletions.
14 changes: 7 additions & 7 deletions pages/06.sprinkles/01.sprinkles/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ taxonomy:

In previous versions of UserFrosting, you had to directly modify the files that come with the default installation in order to add your own functionality. For example, if you wanted to add a field to the user registration page, you had to actually modify `register.twig`. Or, if you wanted to add a new relation on the `User` class, you had to modify the actual `User.php` class that comes with UserFrosting.

Starting in version 4, this is no longer the case! **UserFrosting 4** introduced the **[Sprinkle system](/structure/sprinkles)** as a way to completely isolate the code and content that you and your team produce from the core UserFrosting installation, as well as third-party code. **UserFrosting 5** took this a step further, by allowing Composer to manage Sprinkles and decoupling even more functionality from the base install.
Starting in version 4, this is no longer the case! **UserFrosting 4** introduced the **[Sprinkle system](/structure/sprinkles)** as a way to completely isolate the code and content that you and your team produce from the core UserFrosting installation, as well as third-party code. **UserFrosting 5** took this a step further, by allowing Composer to manage sprinkles and decoupling even more functionality from the base install.

## What is a "Sprinkle"?

A Sprinkle is a functionally cohesive unit of code and content that fits neatly into its own package. A Sprinkle could implement a core component, a third-party plugin, a theme, or even an entire website! As a reminder, any project created from the [App Skeleton](/structure/introduction#the-app-skeleton-your-project-s-template) is still a Sprinkle!
A sprinkle is a functionally cohesive unit of code and content that fits neatly into its own package. A sprinkle could implement a core component, a third-party plugin, a theme, or even an entire website! As a reminder, any project created from the [App Skeleton](/structure/introduction#the-app-skeleton-your-project-s-template) is still a sprinkle!

Each Sprinkle can contain any or all of the following entities:
Each sprinkle can contain any or all of the following entities:

- assets (JS, CSS, images, etc)
- configuration files
Expand All @@ -25,14 +25,14 @@ Each Sprinkle can contain any or all of the following entities:
- templates (Twig files)
- "extra" content that does not fit into any of these categories

As seen in the [App Structure Chapter](/structure), sprinkles can be located anywhere. The only requirement is it's **recipe** need to be accessible by PSR-4 compatible namespace.
As seen in the [App Structure Chapter](/structure), sprinkles can be located anywhere. The only requirement is its **recipe** needs to be accessible through a PSR-4 compatible namespace.

### The Main Sprinkle

Sprinkles are loaded in a specific order, defined by their dependencies, and entities of each type in one sprinkle can extend entities of the same type in other sprinkles. The topmost sprinkle, usually your own project, is called the **main sprinkle**. Every other sprinkles are called **depends sprinkles**.
Sprinkles are loaded in a specific order, defined by their dependencies, and entities of a given type in one sprinkle can extend entities of the same type in other sprinkles. The topmost sprinkle, usually your own project, is called the **main sprinkle**. All other sprinkles are called **depends sprinkles**.

### Default Sprinkles

A basic UserFrosting installation comes with fours sprinkles. A description of them can be found [in a previous chapter](/structure/sprinkles#bundled-sprinkles).
A basic UserFrosting installation comes with four sprinkles. A description of them can be found [in a previous chapter](/structure/sprinkles#bundled-sprinkles).

Now that we're familiar with the basic concept, let's dig into the [contents of a Sprinkle](/sprinkles/contents)!
Now that we're familiar with the basic concept, let's dig into the [contents of a sprinkle](/sprinkles/content)!
36 changes: 18 additions & 18 deletions pages/06.sprinkles/02.content/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ Within each sprinkle, you will find any or all of the following directories and
└── webpack.config.js
```

[notice=note]The file structure, is *somewhat* flexible. For example, `app/` can actually be named whatever you want. All content of `app/src/` can also be customized. However, the other directory inside `app/` (or whatever you call it) should be named the same, to allow your sprinkle to overwrite other sprinkles resources.[/notice]
[notice=note]The file structure is *somewhat* flexible. For example, `app/` can be named whatever you want. All contents of `app/src/` can also be customized. However, other directories inside `app/` (or whatever you call it) should use the above naming system to allow your sprinkle to overwrite other sprinkles' resources.[/notice]

Each of these directories corresponds to specific types of entities that make up your application. UserFrosting has different rules for how each type of entity can extend the entities of the same type loaded in previous Sprinkles. A brief description of each one is listed below.
Each of these directories corresponds to specific types of entities that make up your application. UserFrosting has different rules for how each type of entity can extend the entities of the same type loaded in previous sprinkles. A brief description of each one is listed below.

### /composer.json

The `composer.json` file is primarily used in UserFrosting to map PHP classes, but as this is Composer, it can also be used to reference additional PHP libraries. The `type` key in your sprinkle's `composer.json` file should always be defined as a `userfrosting-sprinkle`. This will make your sprinkles manageable by Composer itself later.
The `composer.json` file is primarily used in UserFrosting to map PHP classes. As this is Composer, it can *also* be used to reference additional PHP libraries. The `type` key in your sprinkle's `composer.json` file should always be defined as a `userfrosting-sprinkle`. This will make your sprinkles manageable by Composer itself later.

The sprinkle `composer.json` should also define the sprinkles this one depends on.

Expand All @@ -57,63 +57,63 @@ $ php bakery webpack

### /webpack.config.js

The `webpack.config.js` file is used for defining **asset entries**, that can be referenced by templates. The advantage of using asset entries (as compared to referencing the specific files) is that multiple files can be quickly referenced by the name of their entries. In production the individual files in each bundle are merged by Webpack Encore, reducing the number of HTTP requests that need to be made and thus reducing client latency and server load. See [Chapter 11](/asset-management/asset-bundles) for more information about asset bundles.
The `webpack.config.js` file is used for defining **asset entries** which can be referenced by templates. The advantage of using asset entries (as compared to referencing specific files) is that multiple files can be quickly referenced by the name of their entries. In production the individual files in each bundle are merged by Webpack Encore, reducing the number of HTTP requests that need to be made and thus reducing client latency and server load. See [Chapter 13](/asset-management/asset-bundles) for more information about asset bundles.

### /app/assets

The `assets` directory contains all of the Javascript, CSS, images, and other static content for your site. See [Chapter 11](/asset-management) for more information about asset management and usage.
The `assets` directory contains all of the Javascript, CSS, images, and other static content for your site. See [Chapter 13](/asset-management) for more information about asset management and usage.

### /app/cache

The `cache` directory is used by the [Cache system](/advanced/caching) to store the cached files. This directory is only required when the sprinkle is used a main Sprinkle.
The `cache` directory is used by the [Cache system](/advanced/caching) to store the cached files. This directory is only required for main sprinkles.

### /app/config

`config` contains the configuration parameters for your Sprinkle. You can define configuration files for different environments (development, testing, production, etc). For each environment, the configuration files in each Sprinkle will be merged together at runtime. See [Chapter 6](/configuration/config-files) for more information.
`config` contains the configuration parameters for your sprinkle. You can define configuration files for different environments (development, testing, production, etc). For each environment, the configuration files in each sprinkle will be merged together at runtime. See [Chapter 9](/configuration/config-files) for more information.

### /app/locale

The `locale` directory contains [translation files](/i18n) for your Sprinkle. Like configuration files, translation files simply return an associative array.
The `locale` directory contains [translation files](/i18n) for your sprinkle. Like configuration files, translation files simply return an associative array.

Just as with configuration files, UserFrosting will recursively merge translation files for the currently selected language(s) from each loaded Sprinkle. This means that each subsequently loaded Sprinkle can override translations from previous Sprinkles, or define new ones entirely.
Just as with configuration files, UserFrosting will recursively merge translation files for the currently selected language(s) from each loaded sprinkle. This means that each subsequently loaded sprinkle can override translations from previous sprinkles, or define new ones entirely.

See [Chapter 16](/i18n) for more information on UserFrosting's internationalization and localization system.
See [Chapter 17](/i18n) for more information on UserFrosting's internationalization and localization system.

### /app/logs

The `logs` directory is used to store the UserFrosting debug logs. This directory is only required when the sprinkle is used a main Sprinkle.
The `logs` directory is used to store UserFrosting debug logs. This directory is only required for main sprinkles.

### /app/schema

The `schema` directory contains the [request schema](/routes-and-controllers/client-input/validation) for your Sprinkle. Schema files in other Sprinkles can be extended by using a custom loader.
The `schema` directory contains the [request schema](/routes-and-controllers/client-input/validation) for your sprinkle. Schema files in other sprinkles can be extended by using a custom loader.

### /app/src

The `src` directory contains the (preferably) [PSR-4](http://www.php-fig.org/psr/psr-4/) compatible PHP code for your Sprinkle. This directory will contain your controllers, database models, [migrations](/database/migrations), [routes](/routes-and-controllers), [service providers](/services), [data sprunjers](/database/data-sprunjing), and any other custom classes that your Sprinkle uses. This is where your Sprinkle Recipe will be found.
The `src` directory contains the (preferably) [PSR-4](http://www.php-fig.org/psr/psr-4/) compatible PHP code for your sprinkle. This directory will contain your controllers, database models, [migrations](/database/migrations), [routes](/routes-and-controllers), [service providers](/services), [data sprunjers](/database/data-sprunjing), and any other custom classes that your sprinkle uses. This is where your sprinkle's Recipe will be found.

[notice=note]The content of `app/src/` can be customized and doesn't need to follow any strict convention.[/notice]

### /app/storage

The `storage` directory is used to store files managed by Filesystem service. This directory is only required when the sprinkle is used a main Sprinkle.
The `storage` directory is used to store files managed by Filesystem service. This directory is only required for main sprinkles.

### /app/templates

To separate content and logic, UserFrosting uses the popular [Twig](http://twig.sensiolabs.org/) templating engine. Since Twig has its own system for [loading templates](http://twig.sensiolabs.org/doc/api.html#built-in-loaders), UserFrosting builds upon this to allow overriding templates in Sprinkles. See [Templating with Twig](/templating-with-twig) for more information on how Twig is integrated into UserFrosting.
To separate content and logic, UserFrosting uses the popular [Twig](http://twig.symfony.com/) templating engine. Since Twig has its own system for [loading templates](http://twig.symfony.com/doc/api.html#built-in-loaders), UserFrosting builds upon this to allow overriding templates in sprinkles. See [Templating with Twig](/templating-with-twig) for more information on how Twig is integrated into UserFrosting.

### /app/test

The `test` directory is similar to `/src`, but for your [Tests](/testing).

### /app/.env

The `.env` file is used to store your local [environnement variables](/configuration/environment-vars). This file is only required when the sprinkle is used a main Sprinkle.
The `.env` file is used to store your local [environment variables](/configuration/environment-vars). This file is only required for main sprinkles.

### /public

The `public` directory is the web server's document / web root. The `index.php` in this directory serves as the front controller for all HTTP requests. This directory is only required when the sprinkle is used a main Sprinkle.
The `public` directory is the web server's document / web root. The `index.php` in this directory serves as the front controller for all HTTP requests. This directory is only required for main sprinkles.

[notice=warning]The public directory *can* technically be renamed to something else. However, some features requires this path to be hardcoded. For example, the asset compiler and locator have this reference hardcoded. To customized the public directory name, further customization would be required in the code and other configuration values.[/notice]
[notice=warning]The public directory *can* technically be renamed to something else. However, some features requires this path to be hardcoded. For example, the asset compiler and locator have this reference hardcoded. To customize the public directory name, further customization will be required in the code and other configuration values.[/notice]

### /vendor

Expand Down
Loading

0 comments on commit 13fca6a

Please sign in to comment.