Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Readme with custom-templates listing #383

Merged
merged 8 commits into from
Oct 9, 2017
Merged

Update Readme with custom-templates listing #383

merged 8 commits into from
Oct 9, 2017

Conversation

reznord
Copy link
Member

@reznord reznord commented Sep 25, 2017

Updates the README reflecting changes to custom templates which is the highlight for 2.0.

Any inputs are more than welcome.

Please do not merge this PR until we are planning for a release.

README.md Outdated

### Using Yarn
- [material] - material-ui template using preact-material-components
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"material template...." material-ui might be confusing with react's material-ui

@reznord reznord mentioned this pull request Sep 25, 2017
@reznord reznord added this to the 2.0 milestone Sep 26, 2017
Copy link
Member

@lukeed lukeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have to step out, but started going thru this.

README.md Outdated
### Templates
Note:

1. You can run dev server using`HTTPS` then you can use the following `HTTPS=true preact watch`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before HTTPS

--src Entry file (index.js) [string] [default: "src"]
--port, -p Port to start a server on [string] [default: "8080"]
--host, Hostname to start a server on [string] [default: "0.0.0.0"]
--https Use HTTPS? [boolean] [default: false]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need ?

README.md Outdated

### Commands
Prerequisites: [Node.js](https://nodejs.org/en/) required version (> 6.x)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about > **Important:** Node v6.x is the minimum requirement.

@silverlight513
Copy link

Made a few tweaks and put it into gist:
https://gist.github.com/silverlight513/35a3c85df18eef73963bc61be146a9b7

I've bullet pointed my suggested updates into a review

Copy link

@silverlight513 silverlight513 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates

  • Moved the templates subsection to under the Official Templates section
  • Changed title from template to Custom templates
  • Updated content of Custom templates

@lukeed
Copy link
Member

lukeed commented Sep 26, 2017

@silverlight513 Thanks! 🙏

I think this is a good example to point out that we need to clarify that the "template" in Official Templates is a different thing than the --template flag.

Nesting them under each other will surely, imo, add to the confusion.

@silverlight513
Copy link

silverlight513 commented Sep 26, 2017

Ah, from the looks of it they appeared to be the same thing. My bad.

@lukeed, would you mind explaining the difference between the --template flag and the Official Templates so that I can update my gist to try and make it clearer that they're separate.

@reznord
Copy link
Member Author

reznord commented Sep 26, 2017

@lukeed @silverlight513 thanks for the reviews and your time 🙏

Official Templates

Till now (the current version) we were just using the code in the examples folder for boot-strapping new projects using preact cli.

But in the next version (v2.0) we moved to custom-templates which will pull the the project from the github/bitbucket. There is a specific structure which these custom-templates need to follow, i.e. they need to place the entire code in a template/ folder.

The contents in the template/ folder from the repo will be used as a template for the project.


Template flag

The template here refers to a custom HTML file which the user can specify for either preact build, preact watch commands.

By default in preact-cli we don't expose the HTML file as CRA does. So, we support a --template flag through which we can pass a custom HTML file where you can add external stylesheets/scripts.

You can use them in the following way:

  • Build command: preact build --template path/to/template.html
  • Serve command: preact serve --template path/to/template.html

@lukeed
Copy link
Member

lukeed commented Sep 26, 2017

@silverlight513 No problem, I'm sure you're not/won't be the only one.

The --template flag is for passing a path to a custom index.html replacement. This is useful for adding <meta> tags to your head, etc. TBH, this may be removed soon in favor of always writing the built-in template.html into your working directory.

The "Official Templates" (or any template) is a new 2.0 feature which allows you to scaffold a new project from an external repository. Here, "template" is synonymous with "boilerplate." The motivation here is to allow community-driven, reusable templates so that users don't feel restricted to what's included in Preact CLI directly.

@lukeed
Copy link
Member

lukeed commented Oct 9, 2017

We'll definitely update this as we go along. Better to have something reflective of the current repo sooner rather than later.

@lukeed lukeed merged commit d7f20bd into master Oct 9, 2017
@lukeed lukeed deleted the update-readme branch October 9, 2017 19:55
developit added a commit that referenced this pull request Oct 11, 2017
* master: (166 commits)
  Use `publicPath` for SW & Manifest paths (#323)
  Purge `examples` dir (#393)
  Update Readme (#383)
  Add `preact list` command (#384)
  linters are dumb
  inject / replace strings in extracted contents
  adding flag to disable service worker
  Convert `css-loader` options to an Object (#349)
  remove `offline-plugin` (unused)
  remove `mkdirp` (unused)
  remove `less` dependencies
  fix linter
  move `htmlPlugin` to `render-html-plugin.js`
  install `css|postcss|style-loader` & regen `yarn.lock`
  remove `chunk.modules` deprecation notice
  rewrite server’s `webpack.config` without blocks
  rewrite client’s `webpack.config` without blocks
  install `webpack-merge`
  rewrite base `webpack.config` w/o blocks
  light refactor
  ...

# Conflicts:
#	src/lib/webpack/webpack-base-config.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants