Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit fb83115

Browse files
Merge pull request #207 from TheComputerM/docs/installation-updates
Docs/installation updates
2 parents b3d7d64 + aa027b5 commit fb83115

File tree

3 files changed

+124
-82
lines changed

3 files changed

+124
-82
lines changed

packages/docs/src/routes/getting-started/contributing.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,26 @@ If you would like to contribute to svelte materialify and improve its functional
1010

1111
## Reporting Issues
1212

13-
It is important to keep your setup to a **minimum** so if you can it is better to reproduce the bug in the [repl playground](https://svelte.dev/repl/2c55788d8ffd4458bfe9bcb5f58956db). Before reporting an issue, ensure that:
13+
Before reporting an issue, ensure that you:
1414

15-
- Search for a similar [issues](https://github.com/TheComputerM/svelte-materialify/issues), it may have been answered.
15+
- searched for similar [issues](https://github.com/TheComputerM/svelte-materialify/issues), it may have been answered already
1616

17-
- Reproduction as to be **minimal** and consise.
17+
- have a **minimal**, concise, reproducible example
1818

19-
- If possible try running the code in the [repl playground](https://svelte.dev/repl/2c55788d8ffd4458bfe9bcb5f58956db).
19+
- have tried providing a [REPL](https://svelte.dev/repl/9982308600f043f3aeb43fb3b17f35b5?version=3.37.0)
2020

21-
## Setting up your environment
21+
## Working on Svelte Materialify
22+
### Setting up your environment
2223

2324
Follow these instructions if you are planning to make a pull request.
2425

25-
## Get the source
26+
### Getting the source
2627

27-
1. Register to [github](https://github.com/).
28+
1. Register to [Github](https://github.com/)
2829
2. Navigate to [svelte-materialify](https://github.com/TheComputerM/svelte-materialify)
2930
3. Press the fork button in the top right corner of the screen
30-
4. Copy the url of your browser, it should now be : https://github.com/**your_github_user_id**/svelte-materialify
31-
5. On your PC open a command prompt window and type the following commands
31+
4. Copy the url of your browser, it should now be: `https://github.com/{your_github_user_id}/svelte-materialify`
32+
5. On your PC, open a command prompt window and type the following commands
3233

3334
```shell
3435
$ git clone https://github.com/{your_github_user_id}/svelte-materialify.git
@@ -37,39 +38,48 @@ $ cd svelte-materialify
3738

3839
This will get the entire repository on your machine, now we can build the library.
3940

40-
## Build
41+
### Building
4142

4243
Building is done with yarn (**not** npm).
43-
From the root folder, install the dependencies by typing:
44+
From the **root folder**, install the dependencies by typing:
4445

4546
```shell
4647
yarn
4748
```
4849

49-
Then to build the main library, svelte materialify itself.
50+
Then build the main library, svelte materialify, itself:
5051

5152
```shell
5253
yarn build
5354
```
5455

55-
To build and develop the documentation site.
56+
To build and develop the documentation site:
5657

5758
```shell
5859
yarn dev
5960
```
6061

61-
Then you can build the API, which provides the definitions and types for the different props/events/slots for the components.
62+
To build the API, which provides the definitions and types for the different props/events/slots of the components:
6263

6364
```shell
6465
yarn api
6566
```
6667

67-
## Submit your change
68+
### Submitting your change
6869

69-
First make a change and make sure it works well by running `yarn lint` and `yarn test`, then commit your changes following [this syntax](https://github.com/conventional-changelog/commitlint/#what-is-commitlint).
70-
71-
For example here
70+
After making a change, make sure it works well by running:
71+
```shell
72+
yarn lint
73+
```
74+
and
75+
```shell
76+
yarn test
77+
```
78+
Please commit your changes following [conventional commit syntax](https://github.com/conventional-changelog/commitlint/#what-is-commitlint), for example:
79+
```shell
80+
git commit -m "docs: improve contributing.md"
81+
```
7282

73-
`docs: improve contributing.md`
83+
Then, **git push** your changes to your github repository.
7484

75-
Then push your changes to your github repository, finally from the github repository web page you can click the Pull Request button and a contributor will review the changes you made.
85+
Finally, from the github repository web page, you can click the **Pull Request** button and a contributor will review the changes you made.

packages/docs/src/routes/getting-started/installation.md

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,65 +10,47 @@ related:
1010

1111
# Installation
1212

13-
Get Started with Svelte Materialify, the best material UI component library for Svelte
13+
Get Started with Svelte Materialify, the best material UI component library for Svelte.
1414

15-
If you want to try out svelte materialify and tinker with it, visit the [repl playground](https://svelte.dev/repl/2c55788d8ffd4458bfe9bcb5f58956db).
15+
If you want to try out svelte materialify and tinker with it, visit the [REPL playground](https://svelte.dev/repl/2c55788d8ffd4458bfe9bcb5f58956db).
1616

17-
We can also **optionally** add [focus-visible](https://github.com/WICG/focus-visible), if you want keyboard focused styles.
17+
You can also **optionally** add [focus-visible](https://github.com/WICG/focus-visible), if you want keyboard focused styles.
1818

1919
```html
2020
<script src="https://unpkg.com/focus-visible@latest/dist/focus-visible.min.js"></script>
2121
```
2222

23-
## Minimal Install
23+
## Install with Default Styles
2424

25-
If want a fast and basic setup then only installing `svelte-materialify` should be fine.
25+
If you want a fast and basic setup, without custom SCSS/SASS, then only installing `svelte-materialify` should be fine:
2626

2727
```shell
2828
$ npm i svelte-materialify
2929
```
3030

31-
And then in your svelte files, import the compiled module for svelte materialify
31+
## Install with Custom Styles
3232

33-
```html
34-
<script>
35-
// In a svelte file
36-
// Import Everything
37-
import * as S from 'svelte-materialify';
38-
// OR
39-
import { Button } from 'svelte-materialify';
40-
// Import a single component
41-
</script>
42-
```
43-
44-
## Advanced Install
45-
46-
If you want finer control over Svelte Materialify and installation you want to install all its peer dependencies.
33+
If you want finer control over Svelte Materialify, install all its peer dependencies:
4734

4835
```shell
4936
$ npm i -D svelte-materialify svelte-preprocess sass postcss
5037
```
5138

52-
```html
53-
<script>
54-
// In a svelte file
55-
// Import Everything from svelte-materialify/src
56-
import * as S from 'svelte-materialify/src';
57-
// OR
58-
import { Button } from 'svelte-materialify/src';
59-
// Import a single component
60-
</script>
61-
```
62-
63-
<Components.Alert type='info'>
64-
65-
Now _you_ can also use SCSS and SASS styles in your own components. Learn more about [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess/blob/master/docs/usage.md).
39+
Now create a **\_material-theme.scss** file. Let's put it in a folder called **theme**.
6640

67-
</Components.Alert>
41+
Include the folder path in the `sveltePreprocess` function in your **rollup.config.js**:
6842

69-
Then create a **\_material-theme.scss** file and place it in any folder, lets put it in a folder called **theme**. Then include the path in the preprocess function in your **rollup.config.js** (likewise follow the same in webpack but for svelte-loader).
43+
```js
44+
svelte({
45+
preprocess: sveltePreprocess({
46+
scss: {
47+
includePaths: ['theme'],
48+
},
49+
}),
50+
...
51+
```
7052
71-
Now add a **svelte.config.js** to add to the root of the project to provide better intellisense.
53+
For better intellisense, you can instead create a **svelte.config.js** and add it to the root of the project:
7254
7355
```js
7456
const sveltePreprocess = require('svelte-preprocess');
@@ -81,7 +63,7 @@ module.exports = {
8163
}),
8264
};
8365
```
84-
66+
Now you can import this file from your main config file, like shown below:
8567
### Rollup
8668
8769
```js
@@ -126,7 +108,7 @@ Learn how to integrate svelte materialify with existing frameworks.
126108
127109
#### Sapper
128110
129-
Add preprocessor for both client and server bundles.
111+
Add the preprocessor for both client and server bundles:
130112
131113
```js
132114
const { preprocess } = require('./svelte.config');
@@ -150,4 +132,20 @@ export default {
150132
};
151133
```
152134
135+
#### Sveltekit
136+
137+
See: https://github.com/TheComputerM/sveltekit-materialify
153138
## Templates
139+
140+
Basic setup done for you:
141+
142+
### Sveltekit
143+
144+
```
145+
npx degit TheComputerM/sveltekit-materialify my-sveltematerialify-project
146+
147+
cd my-svelte-project
148+
149+
npm install
150+
npm run dev
151+
```

packages/docs/src/routes/getting-started/usage.md

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,45 @@ related:
99

1010
# Usage
1111

12-
Once you have installed Svelte Materialify and other dependencies, it is time to learn how to use it.
12+
Once you have installed Svelte Materialify, it's time to learn how to use it.
1313

14+
## Importing the Components
15+
Depending on the Install you chose, there are two ways to import:
16+
### With Default styles
17+
18+
In your svelte files, import the _compiled_ module `from 'svelte-materialify'`:
19+
20+
```html
21+
<script>
22+
import { MaterialApp, Button } from 'svelte-materialify';
23+
</script>
24+
25+
<MaterialApp>
26+
<Button>Compiled (Default styles, used in the REPL)</Button>
27+
</MaterialApp>
28+
```
29+
### With Custom styles
30+
31+
In your svelte files, import the _uncompiled_ module `from 'svelte-materialify/src'`:
32+
33+
```html
34+
<script>
35+
import { MaterialApp, Button } from 'svelte-materialify/src';
36+
//this works, too:
37+
import Button from 'svelte-materialify/src/components/Button/Button.svelte';
38+
</script>
39+
40+
<MaterialApp>
41+
<Button>Uncompiled (Custom styles, defined in _material-theme.scss)</Button>
42+
</MaterialApp>
43+
```
1444
## Layout
1545

16-
All components should be children of `MaterialApp` which has all the global styles and
17-
enables theming.
46+
All components should be children of `MaterialApp`, which provides all the **global styles** and enables theming:
1847

1948
```html
2049
<script>
21-
import { MaterialApp } from 'svelte-materialify';
50+
import { MaterialApp } from 'svelte-materialify'; //or from `/src`
2251
let theme = 'light';
2352
</script>
2453

@@ -27,39 +56,44 @@ enables theming.
2756
</MaterialApp>
2857
```
2958

59+
If you don't want any global styles (other than theming and colors), you can use `MaterialAppMin` instead:
60+
61+
```html
62+
<script>
63+
import { MaterialAppMin } from 'svelte-materialify'; //or from `/src`
64+
let theme = 'light';
65+
</script>
66+
67+
<MaterialAppMin theme="{theme}">
68+
<slot />
69+
</MaterialAppMin>
70+
```
71+
3072
## Theming
3173

32-
What to customise some SCSS variables, worry not, just put them in the **\_material-theme.scss** you had created.
74+
You want to customise some SCSS variables?
75+
Worry not, just put them in the **\_material-theme.scss** you had created:
3376

3477
```scss
78+
$primary-color: #004d26;
79+
$secondary-color: #ff99cc;
80+
$error-color: #420420;
81+
$success-color: #66ff99;
82+
3583
$body-font-family: "Poppins", "Segoe UI", sans-serif;
3684

3785
$spacer: 6px !default;
3886
...
3987
```
4088

41-
To access these variables in your own components just import the variable file from svelte materialify.
89+
To access these variables in your own components, just import the variable file from svelte materialify:
4290

4391
```scss
4492
@import 'svelte-materialify/src/styles/variables';
4593
```
4694

47-
## Components
48-
49-
Just import them one by one or all at once from svelte materialify.
50-
51-
```html
52-
<script>
53-
import * as S from 'svelte-materialify';
54-
55-
import { Button } from 'svelte-materialify';
56-
// OR import from source
57-
import { Button } from 'svelte-materialify/src';
58-
// OR directly import the button component
59-
import Button from 'svelte-materialify/src/components/Button/index.js';
60-
</script>
95+
<Components.Alert type='info'>
6196

62-
<S.Button>These Are</S.Button>
97+
If you want to use SCSS and SASS styles in your own components, [use svelte-preprocess](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/usage.md).
6398

64-
<button>The Same Thing</button>
65-
```
99+
</Components.Alert>

0 commit comments

Comments
 (0)