|
1 |
| -## Before you begin |
| 1 | +--- |
| 2 | +title: Contributing |
| 3 | +customFields: |
| 4 | + - |
| 5 | + key: "is_chapter" |
| 6 | + value: 0 |
| 7 | +--- |
| 8 | + |
| 9 | +Depending on your level of experience with some of the workflows common to many |
| 10 | +open source projects, e.g., git/Github, the command line, and setting up a |
| 11 | +local development environment, contributing to this site may be a breeze or |
| 12 | +come with a bit of a learning curve. If you fit into the former group, great! |
| 13 | +Jump ahead to learn how to get started. |
| 14 | + |
| 15 | +But if you think you're part of the second group, and have had trouble |
| 16 | +participating in open source because of a lack of comfort with the tools, |
| 17 | +**you're still welcome**!. Beyond providing a resource for learning jQuery, a |
| 18 | +major goal of this site is to provide an encouraging environment for you to |
| 19 | +develop these skills, while still making a contribution that matters. Many |
| 20 | +people think that the only way to get involved with a programming project like |
| 21 | +jQuery is to solve intricate bugs that require a nuanced understanding of the |
| 22 | +codebase, or to propose enhancements that may or may not be in scope with the |
| 23 | +development team's plans. The fact is that there's way more: improving |
| 24 | +documentation, working on web properties, and supporting other users are |
| 25 | +crucial aspects where more help is always needed. If you're willing to share |
| 26 | +your time and expertise to help other developers, we're willing to [help you |
| 27 | +get up to speed with the tools](#getting-help) you'll need. |
| 28 | + |
| 29 | + |
| 30 | +## Why Contribute? |
| 31 | + |
| 32 | +If you've ever looked for help with jQuery -- or with web development in |
| 33 | +general -- you know the hunt can sometimes be challenging. It's can be a |
| 34 | +process of wading through a number of different posts until you find that |
| 35 | +article that's the right combination of trustworthy, timely, and helpful for |
| 36 | +your particular problem. And if you're one of those authors -- thanks! -- then |
| 37 | +you are probably familiar with the frustrating feeling of putting a useful tip |
| 38 | +out there, and then wondering if it's actually making its way to the people who |
| 39 | +need it, and what to do with that old post years and versions down the road. |
| 40 | +You're invited to share that energy to help us bring that ecosystem together |
| 41 | +and grow it further! |
| 42 | + |
| 43 | + |
| 44 | +If you've ever helped anyone, colleague or stranger, with a particular problem, |
| 45 | +then you know the value of having a reference you can quickly link to that says |
| 46 | +"here's how you do it." This site is intended to be that compendium, but |
| 47 | +there's always more to refine and add, and we need your help too! |
| 48 | + |
| 49 | +## How Does It Work? |
| 50 | + |
| 51 | +### Content |
| 52 | + |
| 53 | +The content in this site is maintained in |
| 54 | +[this GitHub repository](http://github.com/jquery/learn.jquery.com) as a collection of |
| 55 | +[Markdown](http://daringfireball.net/projects/markdown/) files in the `page` |
| 56 | +directory. The order in which chapters and articles are presented is controlled |
| 57 | +by the [order.yml](https://github.com/jquery/learn.jquery.com/blob/master/order.yml) |
| 58 | +file. |
| 59 | + |
| 60 | +### Design |
| 61 | + |
| 62 | +The site's layout and design is controlled by our |
| 63 | +[`web-base-template`](http://github.com/jquery/web-base-template), a custom |
| 64 | +[WordPress](http://wordpress.org) configuration that runs (or will run in the |
| 65 | +near future) all of the sites run by the jQuery Foundation. The [master |
| 66 | +theme](https://github.com/jquery/web-base-template/tree/master/themes/jquery) |
| 67 | +controls most of the layout for all of our sites, and there is a [child |
| 68 | +theme](https://github.com/jquery/web-base-template/tree/master/themes/learn.jquery.com) |
| 69 | +that controls the templates and styles specific to the learn site. |
| 70 | + |
| 71 | +[`web-base-template`](http://github.com/jquery/web-base-template) powers our sites in |
| 72 | +production and staging environments, and can set up for local development relatively easily. |
| 73 | + |
| 74 | +### Build |
| 75 | + |
| 76 | +The static content in the `page` directory is deployed to a |
| 77 | +[`web-base-template`](http://github.com/jquery/web-base-template) instance |
| 78 | +using [grunt](http://gruntjs.com), specifically with two grunt plugins we've created: |
| 79 | + |
| 80 | +* [grunt-jquery-content](http://github.com/jquery/grunt-jquery-content) - pre-processes content in a variety of formats (HTML, Markdown, XML) into HTML, applying syntax highlighting and some simple partial support, preparing it for processing by |
| 81 | +* [grunt-wordpress](http://github.com/scottgonzalez/grunt-wordpress) - syncs static content to WordPress using [XML-RPC](http://codex.wordpress.org/XML-RPC_Support) |
2 | 82 |
|
3 |
| -You'll need to set up your development environment. Please follow the [README.md] for instructions on setting up WordPress, web-base-templates and the learn.jquery.com repo which contains the content. |
4 | 83 |
|
5 | 84 | ## How Can I Help?
|
6 | 85 |
|
7 |
| -The entire site is managed via [this Git repository](https://github.com/jquery/learn.jquery.com). If you'd like to contribute new articles, make edits to existing content, or work on the site itself, the first thing you'll need is a [fork](https://help.github.com/articles/fork-a-repo). When you have changes you'd like to have reviewed for integration into the site, submit a [pull request](http://help.github.com/send-pull-requests/). |
| 86 | +The simplest and least complicated way to help is to [file |
| 87 | +issues](http://github.com/jquery/learn.jquery.com/issues) if you notice |
| 88 | +mistakes that should be fixed, improvements that can be made, or if you have |
| 89 | +ideas for new articles. We'll use the issues to continue discussion and track |
| 90 | +progress on anything you point out. |
| 91 | + |
| 92 | +If you'd like to go a step further and contribute new articles, make edits to |
| 93 | +existing ones, or work on the site itself, the first thing you'll need is a |
| 94 | +[fork](https://help.github.com/articles/fork-a-repo). When you have changes |
| 95 | +you'd like to have reviewed for integration into the site, submit a [pull |
| 96 | +request](http://help.github.com/send-pull-requests/). |
| 97 | + |
| 98 | +*(If you're unfamiliar with Git, you can still contribute by editing files |
| 99 | +directly via [GitHub's in-browser |
| 100 | +editor](https://github.com/blog/905-edit-like-an-ace). But you won't be able to |
| 101 | +create new content, and you'll still need a GitHub account and a fork of this |
| 102 | +repository. So we encourage you to [learn how to use Git and |
| 103 | +GitHub](http://help.github.com/) as soon as you can.)* |
| 104 | + |
| 105 | +## Local Development |
| 106 | + |
| 107 | +In order to preview your changes locally, work on design/layout issues, or work on |
| 108 | +other jQuery sites' content, and generally contribute most effectively, we |
| 109 | +recommend that you set up a local development environment. You'll need |
| 110 | + |
| 111 | +* [git](http://git-scm.com) |
| 112 | +* [GitHub](http://github.com) account |
| 113 | +* Local PHP/MySQL environment, e.g., [MAMP](http://www.mamp.info/en/index.html), [XAMPP](http://www.apachefriends.org/en/xampp.html) |
| 114 | +* [node.js](http://nodejs.org) |
| 115 | + |
| 116 | +### Initial Deploy |
8 | 117 |
|
9 |
| -If you're unfamiliar with Git, you can still contribute by editing files directly via [GitHub's in-browser editor](https://github.com/blog/905-edit-like-an-ace). But you won't be able to create new content, and you'll still need a GitHub account and a fork of this repository. So we encourage you to [learn how to use Git and GitHub](http://help.github.com/); it'll probably pretty useful no matter what. |
| 118 | +Once you've got these major pieces in place, you'll want to get WordPress and |
| 119 | +`web-base-template` running locally by following [these |
| 120 | +instructions](https://github.com/jquery/web-base-template/blob/master/README.md). |
10 | 121 |
|
11 |
| -Here are some shortcuts to getting set up: |
| 122 | +If you're get everything working right, you should be able navigate to |
| 123 | +[local.learn.jquery.com](http://local.learn.jquery.com) in a browser, you |
| 124 | +should see a site that looks exactly like the [live |
| 125 | +site](http://learn.jquery.com), only without any actual articles. That's where |
| 126 | +your the `learn.jquery.com` content repo comes into play. |
12 | 127 |
|
13 | 128 | 1. Fork the [repository](https://github.com/jquery/learn.jquery.com)
|
14 |
| -2. Clone the repo `git clone git@github.com:*<your username>*/learn.jquery.com.git` |
15 |
| -3. Set up an upstream remote back to the jQuery repo 'git remote add upstream git@github.com:jquery/learn.jquery.com.git' |
16 |
| -4. Branch master into a feature branch `git branch *<feature/issue name/number>*` |
17 |
| -5. Move into that branch `git checkout *<feature/issue name/number>*` |
18 |
| -6. Work on your awesome contribution. |
19 |
| -7. Stage the files to the index in preparation for commit `git add .` |
20 |
| -8. Commit the files to your local repo `git commit -m "*add a relevant message describing the change*"` |
21 |
| -9. Push the files to your github repo `git push origin *<feature/issue name/number>*` |
22 |
| -10. Go to github.com and go to the forked repo and submit a new [pull request](https://help.github.com/articles/using-pull-requests). |
| 129 | +2. Clone the repo -- `git clone git@github.com:<your username>/learn.jquery.com.git` |
| 130 | +3. Enter the directory where you cloned the repo -- `cd learn.jquery.com` |
| 131 | +4. Set up an upstream remote back to the jQuery repo -- 'git remote add upstream git@github.com:jquery/learn.jquery.com.git' |
| 132 | +5. Install grunt (if you haven't already) -- `npm install -g grunt` |
| 133 | +6. Install local build dependencies -- `npm install` |
| 134 | +7. Copy the `config-sample.json` file to `config.json` |
| 135 | +8. Edit `config.json` to use the username and password for your local WordPress network |
| 136 | +9. Build and deploy the files to your local WordPress -- `grunt` |
23 | 137 |
|
24 |
| -## Where is the content? |
| 138 | +* **Windows note:** Line endings need to be Unix-style (line-feed only). Make sure your text editor creates new files with Unix-style line endings. In addition, the following setting to your git config will keep the Unix-style line endings when pulling from the repository.* |
25 | 139 |
|
26 |
| -The site files are organized in a way that you can find all the content in the site in the `page` folder. |
| 140 | +``` |
| 141 | +$ git config --global core.autocrlf true |
| 142 | +``` |
27 | 143 |
|
28 |
| -## How to see changes you make? |
| 144 | +At this point, if you refresh your `local.learn.jquery.com`, your local |
| 145 | +instance should be populated with all of the site content. If it isn't, |
| 146 | +or you're having trouble with any of these steps, please come and |
| 147 | +[seek out some assistance](#getting-help). |
29 | 148 |
|
30 |
| -The site files are built using grunt. After making a change open up your terminal and run grunt. Tip you can run grunt watch and grunt will watch the files for changes so you don't need to continually rerun grunt after each change. |
| 149 | +### Working With Content |
31 | 150 |
|
32 |
| -## How do I add a new article? |
| 151 | +Once you've gotten your environment working, here are the general steps you should follow to make your changes: |
33 | 152 |
|
34 |
| -* Add the file to the right folder in the page folder. |
35 |
| -* Add the slug name (the filename without the extension) to the right area in order.yml |
36 |
| -* Run grunt |
37 |
| -* You should now be able to navigate to the file. |
| 153 | +1. Create a new "feature" branch based on `master` -- `git branch <feature/issue name/number>` |
| 154 | +2. Move onto that branch -- `git checkout <feature/issue name/number>` |
| 155 | +3. Work on your awesome contribution. |
| 156 | +4. As you work and want to preview your changes, use `grunt` to deploy them to the your site. You can also use `grunt watch` to have the site monitor the `page` directory for any changes and automatically have the changes deployed every time you save. |
| 157 | +5. When you're done, stage the new/modified preparation for commit -- `git add page/faq/how-do-i-add-a-new-article-to-the-learn-site.md` |
| 158 | +6. Commit the files to your local repo -- `git commit -m "add a relevant message describing the change"` |
| 159 | +7. Push the files to your GitHub remote -- `git push origin <feature/issue name/number>` |
| 160 | +8. Go to your fork on GitHub and submit a new [pull request](https://help.github.com/articles/using-pull-requests). |
38 | 161 |
|
39 |
| -## What is the syntax used? |
| 162 | +### Adding A New Article |
40 | 163 |
|
41 |
| -We are using the Github flavored Markdown. |
| 164 | +1. Add the file to the right folder in the page folder. |
| 165 | +2. Add the slug name (the filename without the extension) to the desired location `order.yml` |
| 166 | +3. Run `grunt` |
| 167 | +4. You should now be able to navigate to the file. |
42 | 168 |
|
43 |
| -## Article Header Metadata |
| 169 | +### Formatting Articles |
44 | 170 |
|
45 |
| -Each article should have the following header (see below as some metatags are optional): |
| 171 | +Yes! Take a look at our [style guide](http://learn.jquery.com/style-guide) for |
| 172 | +more information on authoring and formatting conventions. |
46 | 173 |
|
47 |
| -``` |
48 |
| ---- |
49 |
| -title: <article title> |
50 |
| -level: [beginner|intermediate|advance] |
51 |
| -source: <url of source of the material derived> |
52 |
| -attribution: |
53 |
| - - Ralph Whitbeck <ralph@email.com> |
54 |
| - - John Paul<john@email.com> |
55 |
| ---- |
56 |
| -``` |
| 174 | +## How Will My Contribution Be Acknowledged? |
| 175 | + |
| 176 | +We will build the attribution of an article based on the git commit logs and present this information in the site. |
| 177 | + |
| 178 | +## <a name="getting-help">Getting Help</a> |
| 179 | + |
| 180 | +If you're struggling to get any part of the site working properly, or have any questions, we're here to help. |
57 | 181 |
|
58 |
| -The `source` attibute is optional. |
59 |
| -If the article was pulled in from an outside source you also need to add an attribution tag to give credit to the original authors. |
| 182 | +The best place to get help is on [IRC](http://en.wikipedia.org/wiki/Internet_Relay_Chat), in the #jquery-content |
| 183 | +channel on [Freenode](http://freenode.net). If you're unfamiliar with IRC, you can use the [webchat gateway](http://webchat.freenode.net/). |
60 | 184 |
|
61 |
| -## How do I get credit for my contribution? |
| 185 | +In addition, the jQuery Content Team holds a [public, weekly |
| 186 | +meetings](http://jquery.org/meeting) on Freenode, at 1PM Eastern time in the #jquery-meeting channel. |
62 | 187 |
|
63 |
| -We will build the attribution of an article based on the git commit logs. Only use the attribution meta tag to give credit to authors outside of git for an article that was pulled in for instance. |
| 188 | +If IRC is not your thing, but you still want or need to get in touch, please use the site's GitHub repo or send us an e-mail to `content at jquery dot org`. |
0 commit comments