Package Data | |
---|---|
Maintainer Username: | acidjazz |
Maintainer Contact: | acidjazz@gmail.com (Kevin Olson) |
Package Create Date: | 2016-07-24 |
Package Last Update: | 2020-04-02 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:17:40 |
Package Statistics | |
---|---|
Total Downloads: | 347 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 1 |
Allows you to use Objectus seamlessly in Laravel 5 and Lumen
.env
and config/
options with as many YAML and JSON files and directories you want to add inside config/
resources/
or public/
folders might useMost all of my projects have extended configuration, everything from style guides to site copy, this allows stylus/css and coffeescript/javascript access to this data
Require this package with Composer
composer require acidjazz/larjectus
Once Composer has installed or updated your packages you need to register Larjectus with Laravel itself. Open up config/app.php and find the providers key, towards the end of the file, and add 'Larjectus\ServiceProvider', to the end:
'providers' => [
...
Larjectus\ServiceProvider::class,
],
For usage with Lumen, add the service provider in bootstrap/app.php
.
$app->register(Larjectus\ServiceProvider::class);
Your gulp task is different from how Objectus works, here is an example of compiling a JSON version of your config for JavaScript access:
🚨 Note the secure
array where i remove any secure data, like DB passwords and AWS credentials. 🚨
exec = require('child_process').exec;
objectify = function() {
var config, secure;
config = {};
secure = ['auth', 'database'];
return exec('php artisan larjectus:config', function(error, result, stderr) {
var dim, i, len, pubconfig;
if (error) {
notify(error);
}
this.config = JSON.parse(result);
pubconfig = this.config;
for (i = 0, len = secure.length; i < len; i++) {
dim = secure[i];
delete pubconfig[dim];
}
return fs.writeFileSync('public/js/config.js', "config="+JSON.stringify(pubconfig)+";", 'utf8');
});
};
objectify();
gulp.task('larjectus', objectify);
gulp.task('watch', function() {
gulp.watch('config/**/*', ['larjectus']);
);
Here is an example of giving config access to stylus you would need the sample gulp task above :
stylus = require('gulp-stylus');
gulp.task('stylus', function() {
return gulp.src('resources/stylus/main.styl')
.pipe(stylus({
rawDefine: {
config: config
}
}).on('error', notify.onError(function(error) {
return {
title: 'Stylus error: ' + error.name,
message: error.message,
sound: 'Pop'
};
})))
.pipe(gulp.dest('public/css/'))
.pipe(sync.stream());
}