Support the ongoing development of Laravel.io →
posted 10 years ago
Views Packages
Last updated 2 years ago.
0

I'd suggest http://www.gulpjs.com for asset management. Also check out this tutorial, https://laracasts.com/lessons/gulp-this.

Last updated 2 years ago.
0

mack-hankins said:

I'd suggest http://www.gulpjs.com for asset management. Also check out this tutorial, https://laracasts.com/lessons/gulp-this.

Thanks for that, and it looks really interesting but it's a little out of my comfort zone as it appears to use node.js? I'm more looking for something that is actually integrated with Laravel a bit tighter, something will check for modifications to the LESS files and compile them if need be.

That said, your suggestion is still helpful for future perusal so I do appreciate it, but for now I'm just after a PHP/Laravel based solution.

Last updated 2 years ago.
0

I do understand comfort zones, but you'd be shocked how easy it is to install node.js. Just for kicks, Google "install nodejs on ubuntu" or whatever you're running. From there it's relatively simple to setup watchers for Gulp.

Here's some other options though....

Hope that helps.

Last updated 2 years ago.
0

mack-hankins said:

I do understand comfort zones, but you'd be shocked how easy it is to install node.js. Just for kicks, Google "install nodejs on ubuntu" or whatever you're running. From there it's relatively simple to setup watchers for Gulp.

Here's some other options though....

Hope that helps.

You know what, I'll give it a go. Gotta jump in eventually right?

Last updated 2 years ago.
0

I used https://github.com/CodeSleeve/asset-pipeline for a bit and it works well. If you are looking for simple, this is a good start.

Although I love Jeffrey Way's stuff and his tutorials are awesome... I was unable to get Laravel Guard working on my VPS. It requires Python and a bunch of Python packages and I could never resolve the dependencies enough to get it to work properly so I gave up ;)

Last updated 2 years ago.
0

mack-hankins said:

By the way, this one doesn't seem to support 4.1 :( It wouldn't install so I checked the Issues page for the project and found that it's a compatibility issue with 4.1. This is just a heads up for others viewing the thread who might be considering trying smartless4laravel. Apparently the dev is on top of things though so I imagine it will be updated soon enough.

Last updated 2 years ago.
0

I'm having some trouble getting my LESS to be parsed correctly. I have this in my application.less file:

@red: #f00;

body {
    background-color: @red;
}

And I'm getting a parse error on the first line. It seems like I can't declare variables in the LESS file for some reason?

Edit: This is the same problem I was having with the Basset/LessPHP combination so I guess I'm not understanding something about how LessPHP works.

Last updated 2 years ago.
0

gnack said:

I'm having some trouble getting my LESS to be parsed correctly. I have this in my application.less file:

@red: #f00;

body { background-color: @red; }

And I'm getting a parse error on the first line. It seems like I can't declare variables in the LESS file for some reason?

Edit: This is the same problem I was having with the Basset/LessPHP combination so I guess I'm not understanding something about how LessPHP works.

can we get some more detail on the wording of the parse error?

Last updated 2 years ago.
0

m0j0r1s1ng said:

gnack said:

I'm having some trouble getting my LESS to be parsed correctly. I have this in my application.less file:

@red: #f00;

body { background-color: @red; }

And I'm getting a parse error on the first line. It seems like I can't declare variables in the LESS file for some reason?

Edit: This is the same problem I was having with the Basset/LessPHP combination so I guess I'm not understanding something about how LessPHP works.

can we get some more detail on the wording of the parse error?

Sorry, I would have included it but it's very nondescript:

parse error: failed at `@red: #f00; ` line: 1
Last updated 2 years ago.
0

I'm not a LESS aficionado by any means, but I don't see anything obviously wrong with your approach. Possibly find a working .less example and see if it works.

Just starting with "does the car have gas?" approach.

Last updated 2 years ago.
0

mack-hankins said:

I'm not a LESS aficionado by any means, but I don't see anything obviously wrong with your approach. Possibly find a working .less example and see if it works.

Just starting with "does the car have gas?" approach.

After checking the stack trace, it looks like this test (in lessc.inc.php - parse() method):

if ($this->count != strlen($this->buffer))

Is what's failing. I'm not sure what that test is supposed to do though, so I'm not sure how to satisfy it.

Last updated 2 years ago.
0

the less seems fine. are you sure it is being parsed by less before it gets used in Laravel? (preprocessed?)

Last updated 2 years ago.
0

m0j0r1s1ng said:

the less seems fine. are you sure it is being parsed by less before it gets used in Laravel? (preprocessed?)

Yeah, the stack trace shows it going through LessPHP, in fact it's LessPHP throwing the error. It's driving me a little insane now.

Last updated 2 years ago.
0

From what I can tell, it's looking at the first line for processing. It loads that line into $buffer and attempts to parse it. It parses it using the parseChunk() method which will increment $this->count to keep track of its position in the buffer. parse() runs parseChunk() and then checks to make sure it made it all the way to the end of the buffer by comparing $this->count to the length of the $buffer.

For some reason, in my case, it's not a match. I haven't done anything odd so I'm really confused by this.

Last updated 2 years ago.
0

You should just dump LessPHP and go straight to the source and use the Less compiler. It's stupidly easy. You don't need to know anything about node.js to do it.

Step 1. Install node.js # yum install node -y Step 2. Install npm # yum install npm -y Step 3. Install less # npm install -g less Step 4. Use it to compile some less files: # lessc styles.less > styles.css

You don't to know or understand anything about node.js to use this.

Also, if you were interested in switching to SASS (which is much better imo), then there are free client-side compiler tools that a super easy as well. Personally I use: http://mhs.github.io/scout-app/ It's simple to use and works perfectly.

Last updated 2 years ago.
0

Jakobud said:

You should just dump LessPHP and go straight to the source and use the Less compiler. It's stupidly easy. You don't need to know anything about node.js to do it.

Step 1. Install node.js # yum install node -y Step 2. Install npm # yum install npm -y Step 3. Install less # npm install -g less Step 4. Use it to compile some less files: # lessc styles.less > styles.css

You don't to know or understand anything about node.js to use this.

Also, if you were interested in switching to SASS (which is much better imo), then there are free client-side compiler tools that a super easy as well. Personally I use: http://mhs.github.io/scout-app/ It's simple to use and works perfectly.

Sigh... I think you're right. I do hate the idea that I'll never know what went wrong here but I think I'm going to have to just give up and try the node approach instead. Thanks guys.

Last updated 2 years ago.
0

Honestly, using a 3rd party thing like LessPHP is probably going to result in weird behavior sometime. It's simply not LESS. It's just a port, which may or may not be accurate.

Don't be bummed out about the node.js thing. Think of it like this: If someone has some really cool useful Python script that you want to use, you just need to install Python in order to run it. You don't have to know anything about Python itself. Just install it so you can run the script. Look at this the same way.

Also, seriously, check out SASS too. I started out in LESS and moved to SASS eventually when I saw the benefits. Never looked back. Also its really easy to convert existing LESS scripts to SASS (unless you are doing some crazy weird complicated LESS functions).

Last updated 2 years ago.
0

This version is more up-to-date: https://github.com/oyejorge/less.php Use that if you want to use Bootstrap 3 (or Less 1.5+ features) You can also look at assetic to handle more filters, but I would suggest Gulp, because you can run the native tasks.

Last updated 2 years ago.
0

Just my two cents. I started developing Laravel apps with LESS and I used the Basset asset management package. However, I didn't want Laravel to rely on compiling the CSS (and because Basset is no longer maintained by Jason Lewis). I have dabbled with node.js in the past and although I was fairly comfortable being able to create a small application I didn't even know where to begin with using modules etc.

I looked around and I came across Grunt.js and that was out of my comfort zone. However, after watching Jeffrey's video tutorial on Gulp.js I was able to get up and running quickly and easily. I was also able to figure out how to compile almost anything via modules built for Gulp.

I understand that it's out of some peoples comfort zones but I can't stress enough how worthwhile it is learning this stuff for future projects.

I actually now use SASS instead of LESS thanks to Jeffrey!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

gnack gnack Joined 4 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.