Padstone for Craft CMS
Padstone is a starter package for Craft 3 built by Imarc. It provides a simple project config as well as example entries and templates.
If you would like to use the older version of Padstone for Craft 2, see the craft2 branch.
Features
- Pre-built CMS sections, including ones for the Homepage, a Blog, News, and Resources. (18 in total!)
- A set of Bootstrap 4 twig templates for you to replace or customize.
- A matrix-based Content Designer field, built within Craft, for laying out pages beyond simple rich text.
- A set of (free) plugins selected by Imarc that we recommend for new projects.
Getting Started
Create a new padstone project with the following composer command:
composer create-project imarc/padstone [folder]
Enter the newly created folder and run the front-end buildstep. The webpack.mix.js file is imported from another project and needs to be updated. Copy the contents of webpack.mix.js-resources and paste them into webpack.mix.js. Then
cd [folder]
npm install
npm run dev
Create your database and ensure the settings in your .env
match your environment. At minimum, you'll need to tell Craft how to connect to your database and your domain.
The default Padstone site is configured to store user sessions in the database. The phpsessions table needs to be added to the new database. If you import the padstone.sql file the table will be created by the import. As an alternative, you can create the table manually by runnng the craft console command.
craft setup/php-session-table
Then run the installer by going to /admin (except for your domain.)
Optionally, you can import the supplied padstone.sql
file into your database if you want Padstone's starter entries.
Logging in
If you import padstone.sql
, the username is admin and the password is padstone. Please change the password after you first login.
Front-End Build
Beyond the typical craft files, you will also see a resources/ folder. Padstone uses Laravel Mix to compile JS and Sass files from the resources/ folder and store the results into the public/ folder:
resources/assets/sass/main.scss
is compiled topublic/css/main.css
resources/assets/js/main.js
is compiled topublic/js/main.js
Additionally, Padstone produces manifest.js
and vendor.js
files that
must be included, in that order, before any of your own JS files. You can
customize this behavior in webpack.mix.js
.
Watching/Building assets
While developing, you most likely want to watch the files you are working on, so the build happens automatically after every save.
npm run watch
If you want to run this same build process for dev without watching, you can run the following:
npm run dev
If you are building to production, run:
npm run prod
What's Included
Sections
Padstone includes the following sections:
- Homepage
- Blog Page and Blog Articles
- News & Events Page, News Articles, and Events
- Resources Page and Resources
- About Page, Leadership Page, Contact Page, Privacy Page, People
- Custom Landing Pages
- Error Page and 404 Page
Plugins
The following plugins are currently included and installed via composer, which is what Craft uses for the Plugin Store as well:
- Admin Bar
- CodeMirror
- Contact Form
- Contact Form Honeypot
- Craft Kindling
- Expanded Singles
- Google Custom Search
- Mix
- Position Fieldtype
- Redactor
- Redirect Manager
- Tags
- Typed link field
- Field Manager - this is included, but not installed by default.
Suggested Additional Plugins
These plugins didn't make the cut for Padstone, but they are plugins we'd recommend people look at if they have specific needs:
- Element API - easy creation of JSON APIs for your website. Likely to be included in the next version of Padstone. Free.
- Feed Me - import content into craft from XML, CSV, and other kinds of exports. Currently Pro is $99 and $30/year.
- Guide - add documentation with Craft. Currently $39 and $19/year.
- Retour - if the included Redirect Manager plugin isn't powerful enough, Retour provides some additional functionality and reporting beyond what Redirect Manager does. Currently $59 and $29/year.
Macros
There is a _macros.twig
file that provides The following macros:
- renderAllBlocks and renderBlock - these are used to render the designedContent field.
- pagination - used to generate pagination.
- commaSeparate - used to generate a comma separated list of elements based on title.
Blocks
The Content Designer Field (designedContent) allows CMS users to use the following blocks out of the box:
- Rich Text
- Two Columns
- Image with Text
- Video with Text
- Testimonial
- HTML Widget/Embed
- Call to Action
- Shared Block
License
Padstone is released under the MIT License.
Contributing
Set up a padstone project with the ability to contribute back.
# clone project and enter directory
git clone git@github.com:imarc/padstone.git
cd padstone
# install composer deps
composer install
# create .env file. if you are using Ops, you can copy .env.example.ops
cp .env.example.server .env
# generate craft security key
php craft setup/security-key
# install boilerplate components
npx imarc/boilerplate-components
echo '@import "~bootstrap/scss/bootstrap";' >> resources/styles/main.scss"
echo 'import "bootstrap";' >> resources/js/main.js"
# import sql into db. If you are using Ops, the command is:
ops mariadb import padstone padstone.sql
# Manual step:
# set DB_DATABASE in your .env to 'padstone'
© 2019-2020 Imarc