Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bunch of updated, fixes and changes... #8

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .editorconfig

This file was deleted.

18 changes: 9 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
extends: 'airbnb-base',
parserOptions: {
sourceType: 'script',
},
env: {
browser: true,
node: true,
},
};
extends: "airbnb-base",
parserOptions: {
sourceType: "script",
},
env: {
browser: true,
node: true,
},
}
52 changes: 26 additions & 26 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: Express Edge CI

on:
push:
branches:
- master
- 'feature/*'
- 'hotfix/*'
pull_request:
branches: [ main ]
push:
branches:
- master
- "feature/*"
- "hotfix/*"
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18', '16', '14']
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["18", "16"]

steps:
- name: Checkout code
uses: actions/checkout@v2
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm install
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Run Linter and Tests
run: |
npm test
npm run eslint
- name: Install Dependencies
run: npm install

- name: Run Linter and Tests
run: |
npm test
npm run eslint
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.idea
/node_modules
yarn.lock
.vscode
/node_modules/
/dist/
package-lock.json
yarn.lock
pnpm-lock.yaml
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist/
5 changes: 5 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
semi: false,
tabWidth: 4,
arrowParens: "avoid",
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## v3.0.0+

- Dropped Node v14 support.
6 changes: 3 additions & 3 deletions LICENSE.md → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)
MIT License

Copyright (c) Daniel Eckermann
Copyright (c) 2018 Daniel Eckermann

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
59 changes: 31 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
# express-edge
# Edge Templating Engine for Express

> Use Edge templating engine with Express

[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fecrmnn%2Fexpress-edge%2Fbadge%3Fref%3Dmaster&style=flat-square&label=build)](https://github.com/ecrmnn/express-edge/actions)
[![npm version](https://img.shields.io/badge/Node.js-v14%2B-green?style=flat-square)](https://github.com/ecrmnn/express-edge)
[![npm version](https://img.shields.io/npm/v/express-edge.svg?style=flat-square)](http://badge.fury.io/js/express-edge)
[![npm downloads](https://img.shields.io/npm/dm/express-edge.svg?style=flat-square)](http://badge.fury.io/js/express-edge)
[![npm license](https://img.shields.io/npm/l/express-edge.svg?style=flat-square)](http://badge.fury.io/js/express-edge)
[![prs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![eslint](https://img.shields.io/badge/code_style-airbnb-blue.svg?style=flat-square)](https://github.com/airbnb/javascript)
Express Edge is an effortless solution for integrating the [Edge](https://github.com/edge-js/edge) templating engine with [Express](https://github.com/expressjs/express). Simplify your templating process and enjoy seamless compatibility.

## Installation

```bash
npm install express-edge --save
npm i express-edge
```

## Usage

See the [Edge documentation](https://docs.adonisjs.com/guides/views/introduction) for how to structure your templates.

Requires Node.js 14+ from `express-edge@3`
You'll need at least [Node](https://github.com/nodejs/node) v15 or higher to use Express Edge v3.

```js
const express = require("express")
const engine = require("express-edge")

```javascript
const express = require('express');
const app = express();
const engine = require('express-edge');
const app = express()

// Automatically sets view engine and adds dot notation to app.render
app.use(engine);
app.set('views', `${__dirname}/views`);
app.use(engine)
app.set("views", `${__dirname}/views`)

// Configure view caching
app.enable('view cache');
// --- or ---
app.diable('view cache');
app.get("/", (req, res) => {
res.render("index", { greeting: "Hello world" })
})

app.listen(PORT, () => {
console.log(`Listening on http://localhost:${PORT}`)
})
```

`views/index.edge`:

```html
<p>{{ greeting }}</p>
```

app.get('/', (req, res) => {
res.render('users.index', { users });
});
### Configure view caching

app.listen(3000);
```js
app.enable("view cache")
// app.disable('view cache');
```

## License
## Development

MIT © [Daniel Eckermann](http://danieleckermann.com)
Run `npm transpile` to build the `./dist` folder.
58 changes: 0 additions & 58 deletions dist/index.js

This file was deleted.

113 changes: 60 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,63 @@
{
"name": "express-edge",
"version": "3.0.0",
"description": "Use Edge templating engine with Express",
"main": "dist/index.js",
"scripts": {
"pretest": "rm -rf dist && npm run transpile",
"test": "node_modules/.bin/mocha test/tests.js",
"transpile": "node_modules/babel-cli/bin/babel.js src --out-dir dist",
"eslint": "node_modules/.bin/eslint src/ test/",
"prepublishOnly": "npm run transpile"
},
"repository": {
"type": "git",
"url": "https://github.com/ecrmnn/express-edge"
},
"babel": {
"presets": [
"env"
"name": "express-edge",
"version": "3.0.0",
"description": "Use Edge templating engine with Express",
"license": "MIT",
"main": "dist/index.js",
"scripts": {
"pretest": "rm -rf dist && npm run transpile",
"test": "mocha test/tests.js",
"transpile": "babel src --out-dir dist",
"eslint": "eslint src/ test/",
"prepublishOnly": "npm run transpile",
"lint": "prettier --check .",
"format": "prettier --write ."
},
"dependencies": {
"edge.js": "^5.5.1"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.7.0",
"body-parser": "^1.20.2",
"chai": "^4.3.7",
"eslint": "^8.38.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.27.5",
"express": "^4.18.2",
"mocha": "^10.2.0",
"prettier": "^3.0.1",
"supertest": "^6.3.3"
},
"engines": {
"node": ">=15"
},
"repository": {
"type": "git",
"url": "https://github.com/ecrmnn/express-edge"
},
"babel": {
"presets": [
"env"
]
},
"author": {
"name": "Daniel Eckermann",
"email": "[email protected]",
"url": "http://danieleckermann.com"
},
"bugs": {
"url": "https://github.com/ecrmnn/express-edge/issues"
},
"homepage": "https://github.com/ecrmnn/express-edge",
"keywords": [
"express",
"express.js",
"adonis",
"edge",
"template",
"templating",
"engine"
]
},
"keywords": [
"express",
"express.js",
"adonis",
"edge",
"template",
"templating"
],
"author": {
"name": "Daniel Eckermann",
"email": "[email protected]",
"url": "http://danieleckermann.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/ecrmnn/express-edge/issues"
},
"homepage": "https://github.com/ecrmnn/express-edge",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.7.0",
"body-parser": "^1.20.2",
"chai": "^4.3.7",
"eslint": "^8.38.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.27.5",
"express": "^4.18.2",
"mocha": "^10.2.0",
"supertest": "^6.3.3"
},
"dependencies": {
"edge.js": "^5.5.1"
}
}
Loading