vesselinv / fuel-sprockets Goto Github PK
View Code? Open in Web Editor NEWAsset management and asset bundling package for FuelPHP
License: MIT License
Asset management and asset bundling package for FuelPHP
License: MIT License
I have the following problem by using "less hat" (http://lesshat.madebysource.com/) and sprockets.
I justed required the lesshat.less file inside my main.less:
//= require lesshat.less
And get the following error:
Twig_Error_Runtime [ Error ]:
An exception has been thrown during the rendering of a template ("parse error: failed at var r="@{arguments}";return r=r.replace(/^\[|\]$/g,"")})())
; ` line: 97") in "partials/html_header.twig" at line 7.
If I remove the require, everything works fine. I don't think its a problem of lesshat, since the same file worked with fuelphp and less before I used sprockets!
Do you have any ideas why it doesn't work?
Hello again
In Sprockets, you don't even talk about images, background-images called in Css/Sass/Less files.
Because if you do css images, there is only one configuration possible. It's making the asset_root_dir = asset_compile_dir.
For example:
my css images are in /assets/img
my css are in /assets/css, with some background-image:url('../img/image.jpg');
asset_root_dir = /assets/
then my asset_compile_dir must be /assets/, if not, the compiled css won't find the images.
Did I miss something in the configuration? Is it the only way to set my compile dir?
This is not a big issue, but since the config lets you finetune the directories, I guess it would be nice to allow this in this case.
Maybe I should not use relative url (../img/), and instead use absolute path (/assets/img/)?
Thanks a lot and keep up the good work.
Hello
Thanks a lot for this great package, it is working well on my Fuel 1.6 except the directive parser.
I just want to do a simple require.
Here is my config:
return array(
'asset_root_dir' => DOCROOT . 'assets/',
'asset_compile_dir' => DOCROOT . 'compile/cache/',
'cache_dir' => DOCROOT . 'compile/sprockets/',
'js_dir' => 'js/',
'css_dir' => 'css/',
'force_minify' => false
);
My two JS files are in the assets/js/folder:
assets/js/application.js
assets/js/common.js
I have
echo Sprockets::js('application.js'); in my Fuel template
And
//= require common.js in the application.js file.
Here is the error:
Fuel\Core\PhpErrorException [ Warning ]: file_get_contents(/myroot/public/assets/js/common.js ): failed to open stream: No such file or directory
PKGPATH/sprockets/classes/sprockets/file.php @ line 38
It says it doesn't find the common.js that is in the sane directory, I don't understand what is happening. It's my local server, all folders are writable.
Any clue?
Kind regards
After merging the last change I would consider bumping the version to 1.4 so users who installed via composer with the require in the documentation will get the latest version which is on master.
When rending the tags for js/css it currently just uses the asset_path which works locally, but it would be very useful to have the ability to use the base_url or root_path prepended to the asset_path.
So currently it would output something like:
/assets/js/application.js
But this feature would be a new config and when set you could do:
http://yoursite.com/assets/js/application.js
For me I use a CDN on production and made up hostname on my local dev.
It looks like this line handles the generating the asset tags, however this class doesn't have access to the config as far as I can tell:
https://github.com/vesselinv/fuel-sprockets/blob/master/classes/sprockets/cache.php#L172
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.