github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/docs/assets.md (about)

     1  [Table of contents](README.md#table-of-contents)
     2  
     3  # Working with the stack assets
     4  
     5  The cozy-stack has some assets: templates, CSS, JS, fonts, etc. For the
     6  deployment in production, they are bundler in the go code and compiled to the
     7  binary. But, it's also nice for developers to have them in a readable format
     8  with a git history: they are also put in the `assets` directory, and some of
     9  them are downloaded from other repositories and listed in `assets/.externals`.
    10  
    11  ## How to work on them on local?
    12  
    13  In short:
    14  
    15  ```sh
    16  $ scripts/build.sh debug-assets
    17  $ go run . serve --assets debug-assets/
    18  ```
    19  
    20  The first command creates a debug-assets directory, with symlinks for local
    21  assets. It also downloads the external assets. The second command starts the
    22  cozy-stack with those assets. If you modify one of the assets (local or
    23  externals) and reload the page in your browser, you will see the new version.
    24  
    25  Tip: if you are debugging an external asset, you may find it practical to
    26  replace the file in `debug-assets` by a symlink from where you build this
    27  asset. For example:
    28  
    29  ```sh
    30  $ rm debug-assets/css/cozy-ui.min.css
    31  $ ln -s path/to/cozy-ui/dist/cozy-ui.min.css debug/assets/css/cozy-ui.min.css
    32  ```
    33  
    34  ## `/dev` route
    35  
    36  In development mode, a `/dev` route is available to render a template or a mail
    37  with given parameter. For example:
    38  
    39  ### Emails
    40  
    41  * http://cozy.localhost:8080/dev/mails/alert_account
    42  * http://cozy.localhost:8080/dev/mails/archiver
    43  * http://cozy.localhost:8080/dev/mails/confirm_flagship
    44  * http://cozy.localhost:8080/dev/mails/export_error
    45  * http://cozy.localhost:8080/dev/mails/import_error
    46  * http://cozy.localhost:8080/dev/mails/import_success
    47  * http://cozy.localhost:8080/dev/mails/magic_link
    48  * http://cozy.localhost:8080/dev/mails/move_confirm
    49  * http://cozy.localhost:8080/dev/mails/move_error
    50  * http://cozy.localhost:8080/dev/mails/move_success
    51  * http://cozy.localhost:8080/dev/mails/new_connection
    52  * http://cozy.localhost:8080/dev/mails/new_registration
    53  * http://cozy.localhost:8080/dev/mails/notifications_diskquota
    54  * http://cozy.localhost:8080/dev/mails/notifications_oauthclients
    55  * http://cozy.localhost:8080/dev/mails/notifications_sharing
    56  * http://cozy.localhost:8080/dev/mails/passphrase_hint
    57  * http://cozy.localhost:8080/dev/mails/passphrase_reset
    58  * http://cozy.localhost:8080/dev/mails/sharing_request
    59  * http://cozy.localhost:8080/dev/mails/sharing_to_confirm
    60  * http://cozy.localhost:8080/dev/mails/support_request
    61  * http://cozy.localhost:8080/dev/mails/two_factor?TwoFactorPasscode=123456
    62  * http://cozy.localhost:8080/dev/mails/two_factor_mail_confirmation
    63  * http://cozy.localhost:8080/dev/mails/update_email
    64  
    65  ### HTML pages
    66  
    67  * http://cozy.localhost:8080/dev/templates/authorize.html
    68  * http://cozy.localhost:8080/dev/templates/authorize_move.html
    69  * http://cozy.localhost:8080/dev/templates/authorize_sharing.html
    70  * http://cozy.localhost:8080/dev/templates/compat.html
    71  * http://cozy.localhost:8080/dev/templates/confirm_auth.html
    72  * http://cozy.localhost:8080/dev/templates/confirm_flagship.html?Email=jane@example.com
    73  * http://cozy.localhost:8080/dev/templates/error.html?Error=oops&Button=Click%20me&ButtonURL=https://cozy.io/
    74  * http://cozy.localhost:8080/dev/templates/import.html
    75  * http://cozy.localhost:8080/dev/templates/install_flagship_app.html
    76  * http://cozy.localhost:8080/dev/templates/instance_blocked.html?Reason=test
    77  * http://cozy.localhost:8080/dev/templates/login.html
    78  * http://cozy.localhost:8080/dev/templates/magic_link_twofactor.html
    79  * http://cozy.localhost:8080/dev/templates/move_confirm.html?Email=jane@example.com
    80  * http://cozy.localhost:8080/dev/templates/move_delegated_auth.html
    81  * http://cozy.localhost:8080/dev/templates/move_in_progress.html
    82  * http://cozy.localhost:8080/dev/templates/move_link.html?Link=https://jane.mycozy.cloud/&Illustration=no
    83  * http://cozy.localhost:8080/dev/templates/move_vault.html
    84  * http://cozy.localhost:8080/dev/templates/need_onboarding.html
    85  * http://cozy.localhost:8080/dev/templates/new_app_available.html
    86  * http://cozy.localhost:8080/dev/templates/oidc_login.html
    87  * http://cozy.localhost:8080/dev/templates/oidc_twofactor.html
    88  * http://cozy.localhost:8080/dev/templates/passphrase_choose.html
    89  * http://cozy.localhost:8080/dev/templates/passphrase_reset.html?ShowBackButton=true&HasCiphers=true&HasHint=true
    90  * http://cozy.localhost:8080/dev/templates/share_by_link_password.html
    91  * http://cozy.localhost:8080/dev/templates/sharing_discovery.html?PublicName=Jane&RecipientDomain=mycozy.cloud&NotEmailError=true
    92  * http://cozy.localhost:8080/dev/templates/oauth_clients_limit_exceeded.html
    93  * http://cozy.localhost:8080/dev/templates/twofactor.html?TrustedDeviceCheckBox=true
    94  
    95  ## In production
    96  
    97  The script `scripts/build.sh assets` download the externals assets, and
    98  transform all the assets (local and externals) to go code. This command is used
    99  by the maintainers of cozy-stack, so you should not have to worry about that
   100  ;-)
   101  
   102  ## Locales
   103  
   104  The locales are managed on transifex. The `.po` files are put in `assets/locales`.
   105  The master branch is synchronized with transifex via their github integration.
   106  
   107  ## Contexts
   108  
   109  It's possible to overload some assets on a context with the `cozy-stack config
   110  insert-asset` command. See [its
   111  manpage](https://docs.cozy.io/en/cozy-stack/cli/cozy-stack_config_insert-asset/)
   112  and [Customizing a context](https://docs.cozy.io/en/cozy-stack/config/#customizing-a-context)
   113  for more details.