Add front-end assets support
There should be support for functions like:
- [ ]
uglifyjs() - [ ]
jshint() - [ ]
uglifycss() - [ ]
unsass() - [ ]
unless()
Hi,
i'm not sure backend languages like PHP should deal with front end resources,
let's tools like grunt or bower actualy "do the job".
I see a lot of usages for a PHP task runner, like:
- [ ] launch the tests
- [ ] check for the quality & security: sensiolabs-security-tool
- [ ] apply some tools for esthetics and standards: php-cs-fixer ...
Take a look at the lot of commands that Symfony framework provide: the majority should be removed and be moved inside a task runner like Fred or dum (my task runner not yet released).
What do you think ?
I see 2 use cases for Fred. One is the front-end stuff (I don't want people to have to install nodejs for that), this replaces Assetic. The other is what you mention, replacing lots of commands from the frameworkbundle that don't belong there. I'm already working on a FredBundle, to provide this.
Ok, this sounds good to me :+1:
What are your plan for implement this functions ?
@romqin I'm still a bit thinking about the scope of Fred. I created it for doing simple tasks, like creating a new blog post for my static website. However, I want it to be usable with Symfony too.
As it's a PHP runner, I agree with @mickaelandrieu that it should also support common PHP tasks. The way I do PHPspec at the moment is executing the PHPspec "binary" for each file in the iterator. What I'm thinking about is creating some sort of BufferIterator for things like this, it would save each file path in an array and only execute the callback for the last array item. This can then run the test and return a new iterator for the result. However, I'm not sure yet this is possible with iterators (as you need to go from n items (the test files) to 1 (the result)).
The result will then be something like:
$fred->task('test', function () use ($fred) {
$fred->load(Finder::create()->files()->names('*Spec.php')->in(__DIR__.'/specs'))
->then(phpspec())
->dist(phpspecReport(STDOUT));
});
To know how to implement the front-end functions, I need to get a better understanding of Assetic and such. Maybe I can reuse them.
@mickaelandrieu A simple counter-example to your statement about limiting fred to php tasks only:
If you take grunt (for example), you have plugins for both sass and imagemagick. However, none of these tools are actually made in JS. They are, respectively, a ruby library and a compiled binary file.
Another example: Even though nodejs is a javascript interpreter, its main focus is to run backend tasks (it includes a servlet, i/o management, etc.). I don't see how this differs to PHP in any way.
Hi,
agree to @csarrazi point, I don't say we "never" should use fred for this kind of frontend stuff, I say many others tools exists and are very great, so why re-invent the wheel ?
I like a lot project like Jolicode Symfony generator because they use the best tool for each use case, without regard of the technology: what do you think of this kind of project ?