-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ed014f7
Showing
15 changed files
with
12,331 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"plugins": [ | ||
"flowtype" | ||
], | ||
"env": { | ||
"browser": true, | ||
}, | ||
"rules": { | ||
"strict":0, | ||
"no-unused-vars": 0, | ||
"no-console": 1, | ||
"semi": ["error", "always"], | ||
"allowImportExportEverywhere": false, | ||
"comma-dangle": [1, { //when to use the last comma | ||
"arrays": "never", | ||
"objects": "never", | ||
"imports": "never", | ||
"exports": "never", | ||
"functions": "ignore", | ||
}], | ||
}, | ||
"extends": ["eslint:recommended", "plugin:flowtype/recommended"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ignore] | ||
|
||
[include] | ||
src/*.js | ||
|
||
[libs] | ||
|
||
[options] | ||
|
||
[lints] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ignore the git local files and the c9 project files | ||
.git | ||
.c9 | ||
|
||
# ignore the repositories where webpack puts the bundles | ||
dist/ | ||
public/bundle/* | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Hello World with Vanilla JS | ||
|
||
> Requirements: Make sure you have node version 8 | ||
#### install the breathecode cli (command-line-interface) | ||
```sh | ||
npm i breathecode-cli -g | ||
``` | ||
|
||
##### Download the boilerplate using the BreatheCode CLI | ||
``` | ||
$ bc start:vanillajs-project -r | ||
``` | ||
##### and install the npm package: | ||
``` | ||
$ npm install | ||
``` | ||
|
||
## Build and Start coding! | ||
|
||
Build the application for the first time... | ||
``` | ||
$ npm run build | ||
``` | ||
And start coding your Vanilla.js application, update the `index.html`, `index.css` or `index.js` depending on your needs. | ||
|
||
## FAQ | ||
|
||
#### 1) How do I run my code in Cloud 9? | ||
Right click on `./index.html` and choose the __RUN__ option on the menu. | ||
|
||
#### 2) Where do I write my code? | ||
It depends on the language, but you have `./src/js/index.js`, `./src/css/index.css` and `./index.html` respectively, you can add new `.html` as you please, just make sure to include the bundle.js using the `<script>` tag. | ||
|
||
__Note:__ remember that the JS workflow starts inside `window.onload`. | ||
|
||
#### 3) I don't see my changes. | ||
Remember that you have to re-bundle every time you update your SCSS or JS files `$ npm run build`. | ||
Remember also to refresh cleaning the cache (command+shift+r on mac, control+shift+r on pc & linux) | ||
|
||
#### 4) I ran `$ npm run build` and I still don't see my changes | ||
Please check the output on the console after bundling; maybe you have an error when bundling. | ||
Also, check the chrome inspector for errors on the console. | ||
|
||
#### 5) How do I include more images on my project? | ||
Just add them into your HTML file, the same way you did before knowing about WebPack. | ||
|
||
#### 6) How do I include more JS files? | ||
If the JS file is not your own, you can import it using `<script>` tags on your index.html before the `</body>` closing tag. If the file is yours is better to add it using the import statement inside index.js content. | ||
|
||
#### 7) How can I run the development server? | ||
This boilerplate does not support the webpack development server; you have to `$ npm run build` every time you update your JS or SCSS files. | ||
|
||
#### 8) How do I publish the website? | ||
|
||
This boilerplate is 100% compatible with the free github pages hosting. Publish your website by runing: | ||
```sh | ||
$ npm run deploy | ||
``` | ||
|
||
Very easy and in just one step! Push to your __master__ branch and use the free hosting that comes with [GitHub pages](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/#enabling-github-pages-to-publish-your-site-from-master-or-gh-pages), the project is ready to be published. Remember to choose to run the Github Page from your master branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
var ghpages = require('gh-pages'); | ||
var Console = require('bc-console'); | ||
var webpack = require('webpack'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
|
||
var remoteOriginUrl = require('remote-origin-url'); | ||
var gh = require('parse-github-url'); | ||
|
||
if (!fs.existsSync(path.resolve(__dirname,'.git'))){ | ||
Console.error("No repository found on this project"); | ||
Console.help("Follow this steps to create a new repository for your project: http://kbroman.org/github_tutorial/pages/init.html"); | ||
return; | ||
} | ||
|
||
const origin = remoteOriginUrl.sync(); | ||
if(!origin || origin==''){ | ||
Console.error("No remote origin has been found on this repository"); | ||
Console.help(`Check your remote by doing: | ||
$ git remote get-url origin | ||
Add your remote by doing: | ||
$ git remote add origin <github_repository_url> | ||
`); | ||
return; | ||
} | ||
Console.info("The remote was found successfully, starting the deploy from here: "+origin); | ||
|
||
const repository = gh(origin); | ||
const compiler = webpack(require(path.resolve(__dirname, 'webpack.config.js'))); | ||
compiler.run((err, stats) => { | ||
if (err || stats.hasErrors()) { | ||
console.log(stats.toString({ | ||
colors: true | ||
})); | ||
Console.error("There was an error compiling, review above"); | ||
return; | ||
} | ||
Console.success("Your code compiled successfully, proceding to deploy..."); | ||
ghpages.publish('public', function(err) { | ||
if(err){ | ||
console.error(err); | ||
Console.error("There was an error publishing your website"); | ||
return; | ||
} | ||
//https://<github_user>.github.io/<repository-name> | ||
Console.success(`Your website has been deployed successfully here: https://${repository["owner"]}.github.io/${repository["name"]}`); | ||
}); | ||
}); |
Oops, something went wrong.