Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Dec 9, 2019
1 parent 6569d1c commit 6366532
Show file tree
Hide file tree
Showing 13 changed files with 433 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; http://editorconfig.org
;
; Sublime: https://github.com/sindresorhus/editorconfig-sublime
; Phpstorm: https://plugins.jetbrains.com/plugin/7294-editorconfig

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{*.js,*.css,*.scss,*.html}]
indent_size = 2
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cache:
directories:
- $HOME/.composer/cache/files

language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

matrix:
allow_failures:
- php: nightly

install:
- composer install --prefer-dist

before_script:
- for P in src tests; do find $P -type f -name '*.php' -exec php -l {} \;; done

script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml

after_success:
- bash <(curl -s https://codecov.io/bash)
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.0 2019-12-07 10:41:54 UTC

- init library
73 changes: 73 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
## How to contribute

### Before you start

<!-- This section contains conventions/standards contributors must follow -->
<!-- For example: Commit messages should follow angular standard -->

### Setting up

You may need to fork this project in [GitHub](https://github.com/adhocore/twig-yall).

```sh
git clone git@github.com:adhocore/twig-yall.git

# OR if you have a fork
git clone git@github.com:<your_github_handle>/twig-yall.git

# You may also add upstream
git remote add upstream https://github.com/adhocore/twig-yall.git

cd twig-yall

# Create a new branch
git checkout -b $branch_name

# Install deps
composer install -o
```

### Moving forward

```sh
# Open twig-yall in IDE
subl twig-yall

# ... and do the needful

# Optionally run the lint
for P in src tests; do find $P -type f -name '*.php' -exec php -l {} \;; done

# ... and phpcs fixer or stuffs like that!

# Run tests
vendor/bin/phpunit --coverage-text


# If your feature takes long your dev branch might be out of sync, you may want to
git checkout $branch_name
git pull upstream master # branch could be something else than master
```

### Finalizing

Everything looking good?

```sh
# Commit your stuffs
git add $file ...$files
git commit -m "..."

# Push 'em
git push origin HEAD
```

Now goto [GitHub](https://github.com/adhocore/twig-yall/compare?expand=1), select your branch and create PR.

### Getting PR merged

You have to wait. You have to address change requests. Be patient.

Thank you for contribution!

**Lastly** Please be informed that your works will be licensed same as the project [license](./LICENSE)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Jitendra Adhikari

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
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.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## adhocore/twig-yall

[![Latest Version](https://img.shields.io/github/release/adhocore/twig-yall.svg?style=flat-square)](https://github.com/adhocore/twig-yall/releases)
[![Travis Build](https://img.shields.io/travis/com/adhocore/twig-yall.svg?branch=master&style=flat-square)](https://travis-ci.com/adhocore/twig-yall?branch=master)
[![Scrutinizer CI](https://img.shields.io/scrutinizer/g/adhocore/twig-yall.svg?style=flat-square)](https://scrutinizer-ci.com/g/adhocore/twig-yall/?branch=master)
[![Codecov branch](https://img.shields.io/codecov/c/github/adhocore/twig-yall/master.svg?style=flat-square)](https://codecov.io/gh/adhocore/twig-yall)
[![StyleCI](https://styleci.io/repos/{styleci}/shield)](https://styleci.io/repos/{styleci})
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](./LICENSE)


## Installation
```bash
composer require adhocore/twig-yall
```

## Usage
In twig template you would do something like this:

```twig
<img {{ lazy('path/to/image.jpg', 'class1 class2') }} alt="something" />
```
Then it will be rendered as:

```html
<!-- indented into multiline for clarity only -->
<img src="path/to/placeholder.gif"
data-src="path/to/image.jpg"
class="lazy class1 class2"
alt="something" />
```

Donot forget to put the yall loader somewhere in the footer:
```twig
{% yallify %}
```

## API

<!-- DOCS START -->
<!-- DOCS END -->

## Contributing

Please check [the guide](./CONTRIBUTING.md)

## LICENSE

> &copy; [MIT](./LICENSE) | 2019, Jitendra Adhikari
40 changes: 40 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "adhocore/twig-yall",
"description": "Lazy load image in twig using malchata/yall.js",
"type": "library",
"keywords": ["php","twig-yall"],
"license": "MIT",
"authors": [
{
"name": "Jitendra Adhikari",
"email": "jiten.adhikary@gmail.com"
}
],
"autoload": {
"psr-4": {
"Ahc\\TwigYall\\": "src/"
},
"files": []
},
"autoload-dev": {
"psr-4": {
"Ahc\\TwigYall\\Test\\": "tests/"
}
},
"require": {
"php": ">=7.0.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5 || ^7.5",
"twig/twig": "^1.42"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
}
},
"scripts": {
"test": "vendor/bin/phpunit --coverage-text"
}
}
49 changes: 49 additions & 0 deletions docs/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Introduction

**This is a**

<!-- Put a cross `x` in one of the below boxes -->
- [ ] Bug/Issue
- [ ] Feature request
- [ ] General stuff

<!-- BugStart (Remove this line if reporting bug)
## Describe the bug/issue
I wanted to ...
### What happened
...
### What is expected
...
### Reproduction steps
- ...
### Sample code
### Environment
- OS:
- PHP version:
- twig-yall version:
BugEnd (Remove this line if reporting bug) -->

<!-- FeatureStart (Remove this line if requesting feature)
## Explain the feature
FeatureEnd (Remove this line if requesting feature) -->

<!-- GeneralStart (Remove this line if it is general concern)
## Explain yourself
...
GeneralEnd (Remove this line if it is general concern) -->
25 changes: 25 additions & 0 deletions docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Introduction

**This is a**

<!-- Put a cross `x` in relevant boxes below -->
- [ ] New feature
- [ ] Fix for ... <!-- (the issue/bug) -->
- [ ] General improvement
- [ ] Backward incompatible change

It closes # <!-- (Put the issue number after `#`) -->

## Describe the change

...

## How to use it

...

#### Sample code

```php

```
23 changes: 23 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="Twig-yall Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
Loading

0 comments on commit 6366532

Please sign in to comment.