Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jarstone committed Apr 21, 2021
1 parent 1d5b026 commit 468ffa3
Show file tree
Hide file tree
Showing 16 changed files with 683 additions and 1 deletion.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example
69 changes: 68 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,69 @@
# eses
Ejs Scss ES6 template builder
Ejs Scss ES6 template builder, to create html template

## Installation
`npm i eses --save-dev`

## Features
- ejs template
- scss styling
- es6
- autoprefixer
- watch & live reload
- libraries copier
- options to use sass(js) or dart-sass

## Commands
package.json:
```json
"scripts": {
"dev": "eses --dev",
"build": "eses",
"lib": "eses --lib"
}
```

`npm run build`\
`npm run dev`\
`npm run lib`

## Default configuration
eses.config.js:
```javascript
module.exports = {
path: {
html: {
src: 'source/ejs',
dst: 'compiled/html',
},
css: {
src: 'source/scss',
dst: 'compiled/css',
},
js: {
src: 'source/js',
dst: 'compiled/js',
}
},
server: {
host: '127.0.0.1',
port: 3000,
watch: 'compiled',
verbose: false,
},
useDartSass: false
}
```
## Example libraries
eses.libraries.js:
```javascript
module.exports = {
dst: 'compiled/lib',
lib: {
'bootstrap': 'node_modules/bootstrap/dist/js/bootstrap.bundle.j*',
'jquery': ['node_modules/jquery/dist/jquery.js', 'node_modules/jquery/dist/jquery.slim.js'],
'photoswipe': ['node_modules/photoswipe/dist/*', '!node_modules/photoswipe/dist/*.min.js'],
'photoswipe/default-skin': 'node_modules/photoswipe/dist/default-skin',
}
}
```
24 changes: 24 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
path: {
html: {
src: 'source/ejs',
dst: 'compiled/html',
},
css: {
src: 'source/scss',
dst: 'compiled/css',
},
js: {
src: 'source/js',
dst: 'compiled/js',
},
},
server: {
host: '127.0.0.1',
port: 3000,
watch: 'compiled',
verbose: false,
},
useDartSass: false,
customConfig: 'eses.config.js',
}
5 changes: 5 additions & 0 deletions example/eses.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
server: {
port: 8080,
}
}
9 changes: 9 additions & 0 deletions example/eses.libraries.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
dst: 'compiled/lib',
lib: {
'bootstrap': 'node_modules/bootstrap/dist/js/bootstrap.bundle.j*',
'jquery': ['node_modules/jquery/dist/jquery.js', 'node_modules/jquery/dist/jquery.slim.js'],
'photoswipe': ['node_modules/photoswipe/dist/*', '!node_modules/photoswipe/dist/*.min.js'],
'photoswipe/default-skin': 'node_modules/photoswipe/dist/default-skin',
}
}
15 changes: 15 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"scripts": {
"dev": "eses --dev",
"build": "eses",
"lib": "eses --lib"
},
"devDependencies": {
"eses": "^1.0.0"
},
"dependencies": {
"bootstrap": "^4.6.0",
"jquery": "^3.6.0",
"photoswipe": "^4.1.3"
}
}
3 changes: 3 additions & 0 deletions example/source/ejs/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title": "Eses"
}
1 change: 1 addition & 0 deletions example/source/ejs/include/_css.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="stylesheet" href="../css/main.css">
1 change: 1 addition & 0 deletions example/source/ejs/include/_js.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script src="../js/main.js"></script>
21 changes: 21 additions & 0 deletions example/source/ejs/index.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%- include('include/_css') %>
<title><%= title %></title>
</head>
<body>
<div class="container py-3">
<div class="card border-0 shadow-sm">
<div class="card-body">
<p>Welcome to <%= title %></p>
</div>
</div>
</div>

<%- include('include/_js') %>
</body>
</html>
8 changes: 8 additions & 0 deletions example/source/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { getTransitionDuration } from './modules/_util'

function init() {
console.log('hello world')
}
init()

console.log(getTransitionDuration(document.body))
7 changes: 7 additions & 0 deletions example/source/js/modules/_util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const getTransitionDuration = element => {
return parseFloat(window.getComputedStyle(element).transitionDuration) * 1000
}

export {
getTransitionDuration,
}
1 change: 1 addition & 0 deletions example/source/scss/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$body-bg: #f1f1f1;
2 changes: 2 additions & 0 deletions example/source/scss/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "variables";
@import "../../node_modules/bootstrap/scss/bootstrap";
Loading

0 comments on commit 468ffa3

Please sign in to comment.