Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webchemistry/assets
Configure css, js files in neon, yaml format and minify them with grunt.
https://github.com/webchemistry/assets
css js minification minifier minifying-files neon-files yaml-files
Last synced: about 1 month ago
JSON representation
Configure css, js files in neon, yaml format and minify them with grunt.
- Host: GitHub
- URL: https://github.com/webchemistry/assets
- Owner: WebChemistry
- Created: 2016-02-10T13:31:47.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-08-30T07:53:34.000Z (over 6 years ago)
- Last Synced: 2024-11-15T21:07:55.839Z (about 1 month ago)
- Topics: css, js, minification, minifier, minifying-files, neon-files, yaml-files
- Language: PHP
- Homepage:
- Size: 22.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Registration
```neon
extensions:
assets: WebChemistry\Assets\DI\AssetsExtension
assets:
resources:
- %appDir%/assets.neon
```## Assets config
Example in app dir create assets.neon:
```yaml
## Front module
front:
css:
"compiled/front.min.css":
- "css/*.css"
- "plugins/bootstrap/css/bootstrap.css"
- "plugins/forms/css/jquery.datetimepicker.css"
- "plugins/forms/css/selectize.css"
- "plugins/forms/css/selectize.default.css"
js:
"compiled/front.min.js":
- "plugins/nette/netteForms.js"
- "plugins/nette/nette.ajax.js"
- "plugins/nette/extensions/spinner.ajax.js"
- "plugins/jquery-nette-forms/libraries.js"
- "plugins/jquery-nette-forms/errors.js"
- "plugins/forms/js/inputmask.min.js"
- "plugins/forms/js/inputmask.regex.extensions.min.js"
- "plugins/forms/js/jquery.inputmask.min.js"
- "plugins/forms/js/jquery.datetimepicker.js"
- "plugins/forms/js/selectize.min.js"
- "plugins/bootstrap/js/bootstrap.js"
- "js/main.js"
"compiled/front.header.min.js":
- "plugins/jquery/jquery.min.js"
```## Presenter
```php
class BasePresenter extends Nette\Application\UI\Presenter {
use WebChemistry\Assets\TPresenter;
}
```## Template
```html
{$assets->getCss('compiled/front.min.css')}
{$assets->getJs('compiled/front.head.min.js')}```
## Grunt task
package.json
```json
{
"name": "Project",
"version": "1.0.0",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-cssmin": "~0.14.0",
"grunt-contrib-uglify": "~0.11.1",
"grunt-nette-assets": "~0.1.0"
},
"dependencies": {}
}
```Install:
```
npm install
```Gruntfile.js:
```js
module.exports = function(grunt) {
grunt.config.init({
netteAssets: {
target: {
config: 'app/resource.neon',
basePath: 'www/'
}
}
});grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-nette-assets');return grunt.registerTask('default', ['netteAssets', 'uglify', 'cssmin']);
};
```Run grunt:
```
grunt
```