Skip to content

Commit

Permalink
Add babel loader on webpack-stream to transpile es6 code
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielhsp committed Feb 13, 2018
1 parent 4de2eda commit d344624
Show file tree
Hide file tree
Showing 9 changed files with 705 additions and 7 deletions.
17 changes: 17 additions & 0 deletions .babelrc
@@ -0,0 +1,17 @@
{
"presets": [
[
"env",
{
"modules": false,
"useBuiltIns": true,
"targets": {
"browsers": [
"> 5%",
"IE >= 11"
]
}
}
]
]
}
2 changes: 2 additions & 0 deletions build/bundle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions gulpfile.js
Expand Up @@ -70,6 +70,16 @@ gulp.task('scripts', () => {
modules: ['src/scripts', 'node_modules']
},

module: {
loaders: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/
}
]
},

plugins: [
new webpack.webpack.DefinePlugin({
VERSION: JSON.stringify(pkg.version)
Expand Down
32 changes: 32 additions & 0 deletions index.php
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>A simple demo page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header class="header">
<div class="container">
<nav class="menu">
<ul class="menu-list">
<li class="menu-item"><a href="#" class="menu-link">Lorem 01</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 02</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 03</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 04</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 05</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 06</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 07</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 08</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 09</a></li>
<li class="menu-item"><a href="#" class="menu-link">Lorem 010</a></li>
</ul>
</nav>
</div>
</header>
<script src="build/bundle.min.js"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -7,6 +7,9 @@
"license": "MIT",
"dependencies": {
"autoprefixer": "^7.2.2",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1",
"browser-sync": "^2.23.5",
"css-mqpacker": "^6.0.1",
"cssnano": "^3.10.0",
Expand Down
1 change: 1 addition & 0 deletions src/scripts/bundle.js
@@ -0,0 +1 @@
'use strict';
6 changes: 6 additions & 0 deletions src/styles/style.scss
@@ -0,0 +1,6 @@
@charset "UTF-8";

body {
border: none;
background-color: red;
}
9 changes: 9 additions & 0 deletions style.css
@@ -0,0 +1,9 @@
/*
* Theme Name: my_project
* Author: Author's name here
* Author URI: http://www.yourwebsite.com
* Description: Your project description here
* Version: 1.0.0
*/

body{border:none;background-color:red}

0 comments on commit d344624

Please sign in to comment.