- Craft 3 Documentation: Craft 3 Docs
- Twig Template Language: Twig Symfony Twig Primer
- Download Craft CMS and copy everything from vendor into this repo. If you want to add the whole cms to your repo remove the line
/vendor
in.gitignore
- All templates are separated according to the Atomic Design Pattern
- All pages with url's are found in
/templates/_pages
from there on all elements are split into includes. Its easiest to look for the include in_pages
for orientation. - All templates inherit
_layout.twig
so if you need global variables, put them there. - There is a file called
_incl/docMacros.twig
which contain a few twig snippets. (eg. every wysiwyg field is sanitised trough a macro). - SEO Code: All twig SEO is written in
_organisms/seoPage
. It grabs all the seo fields of each page and puts it into the head. If there are empty seo fields on a page it will grab the fallback text fromGlobale Inhalte
- Stylesheets are also separated according to the Atomic Design Pattern (Although it doesn't work as nicely as in the twig markup)
- It is 2018 how about not using a frmawork? Use CSS Grid instead. It is awesome!
- The stylesheet
IEhack.scss
is applied on IE 11 and contains all adjustments. Pleas place IE stuf only there. I now browser detection is a evil thing. but what can you do? - For npm package specific styling there is a
plugins.scss
for ugly overrides (e.g. Lightbox Plugin).
- I load Webfoints via the Google Webfont Loader
- The initial Webfont styles are loaded as inline css before the actual stylesheet for more speed and less FOUT (see
_incl/docWebfont
). I use Joni Korpis Trick for smoother font load
- All layouts are made with either grid or flexbox
- Each page has it's own grid stylesheet. They are suposed for layout mechanics only!!
- Static translations in Craft are stored in the
translations
and then called in twig with thet
Filter:{{ 'Deine übersetzung' | t }}
Static Translations
- All style assets are in
theme_src
and will be compiled intowww/theme/..
. - For Javascript I use Webpack. The webpack directives are split into a
dev
andproduction
build. - css is compiled via
postcss
. The build will be run trough a autoprefixer. - I hate build tools they are a mistery to me. This setup works so I hope I will never have to touch it again.
- on dev environements run:
npm i
once and then for development:npm run dev
- Craft 3 uses DOTENV principle
- All custom values are stored in a
.env
file which are applied into the files inconfig
. The.env
file mustn't be checked in because the whole idea is to not have any passwords in the repo. Just rename.env-example
and adjust values accordingly
- copy the db from the specific server
- Folders where CMS users can upload files trough the CMS are not in the repo. See
.gitignore
for said folders.