9

I have a big codeigniter project that has been going on / selling for a while. I want to integrate SASS into it however SASS seems mainly - not strictly - for rails. I have been reading up on it and even though there are sparks for codeigniter that will allow SASS, it does not support recent versions of it very well.

I have yet to see instructions on how to implement SASS on codeigniter. Anyone can provide some clean instructions please?

Thank you !

ODelibalta
  • 2,194
  • 1
  • 18
  • 28
  • 3
    No, SASS is definitely not just for Rails. Most people just render SASS/SCSS to CSS locally rather than having the server handling it - `sass --update`. – ceejayoz Jul 02 '13 at 00:50
  • All my project files are hosted on servers. We SSH in and edit files within our dev server. Working local is not an option. Thank you – ODelibalta Jul 02 '13 at 01:14
  • 3
    You can do `sass --update` on the dev server via SSH just as easily. – ceejayoz Jul 02 '13 at 01:16
  • @Sage Working local *should* be an option. It's not 1999, you don't have to edit code on a remote server anymore. At least you're not doing all your updates via FTP I guess... – user229044 Jul 02 '13 at 21:06
  • 1
    You are right it's not 1999 and we live in a cloud computing based world. Thank you for your comment. – ODelibalta Jul 02 '13 at 21:16
  • What's your goal here? Having SASS be compiled automatically by CodeIgniter before serving the files? Or just having a way to compile these SASS files remotely? – Steven Lu Jul 18 '13 at 04:30
  • compile the sass remotely on a server that runs codeigniter and does not have ruby installed. – ODelibalta Aug 01 '13 at 20:17

2 Answers2

3

Sass and CodeIgniter does not need to be integrated in that sense. They are separate parts of your application.

Sass is a CSS pre-processor built in Ruby, but it's output is just normal CSS. It's these CSS files that you will reference is your HTML (CodeIgniter views) and that you will deploy to your server. On your development machine you need to have Ruby installed to run the Sass compiler, but that's it.

eldh
  • 336
  • 2
  • 8
  • There should be a way to run it without ruby shouldn't it? Thanks you – ODelibalta Aug 01 '13 at 20:17
  • @Sage Sass is essentially a ruby program that takes files written with the .sass or .scss syntax and outputs normal .css. There are ports (like this: https://github.com/richthegeek/phpsass) but I STRONGLY suggest you use the ruby gem instead. I also strongly suggest you take some time to set up a good local dev environment if you haven't already. – eldh Aug 02 '13 at 09:33
  • 1
    Update: node-sass is pretty mature now, and can be used. It's faster than the ruby version but lacking a few features. – eldh Apr 15 '15 at 08:04
0

We can compile SCSS file in any Project / Framework with desire folder structure with the help of node-sass have a look this answer

For Codeigniter, I create assets folder (assets/scss/style.scss) in the root of the application and compile my CSS in assets/css/style.css and then call my CSS like this.

<link rel="stylesheet" href="<?php echo base_url() . 'assets/css/style.css' ?>">
Ismail Farooq
  • 6,309
  • 1
  • 27
  • 47