I try to pass Bootstrap Variables to other files in Rails - and fail.
My application.css.scss looks like this:
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
/* Import own Vars */
#import 'myvars';
/* Import Twitter Bootstrap */
#import 'bootstrap';
/* Import own layout */
#import 'custom';
When I create a $testVar: 100px; in _myvars.scss and try to use it in custom.css.scss it´s not working - the page fails to load and I get an Undefined variable: "$testVar".-Error
It works when defining the variable directly in custom.css.scss but I´d rather have a overview-file with all my variables (like I used to have when using TB as a standalone). I´m very new to Rails, so please be patient :)
Thanks in advance!
You have to remove *= require_tree . . Check this screen cast for more info.
Related
I'm starting to learn Prestashop, so I've downloaded a free theme and started to edit it. But I have a problem with the navbar and now I need to edit it.
This is my navbar:
I need to add all my categories to the category section of the navbar, but I'm not able to do it. This theme uses Leo Bootstrap Mega Menu. So when I edited that module to add a product, it gives me the following error:
How would I fix this?
Your theme or module uses a function that is not included in your version of Prestashop. Try to put this function in your classes/Language.php file before the last }.
/**
* Returns an array of language IDs.
*
* #param bool $active Select only active languages
* #param int|bool $id_shop Shop ID
*
* #return array
*/
public static function getIDs($active = true, $id_shop = false)
{
return self::getLanguages($active, $id_shop, true);
}
As for #Roman K suggestion. I recommend you should add the code to overrides folder. It will be easier for you when you upgrade to new version of Prestashop.
If you still get the error. I think you should download other Prestashop Mega Menu Module.
With Java, import is really easy and clear.
You import with the following statement :
import fr.domain.MyUtils;
Then you can use it like this:
MyUtils.myStaticMethod();
You need to namespace MyUtils only if there are two in the same file.
With Typescript AMD and requirejs it seems to be more complicated.
Here the import statement:
import u = require('fr/domain/MyUtils');
And the way to use it:
u.fr.domain.MyUtils.myStaticMethod();
Quite verbose...
The only way I found so fare to use an alias was to double the import statement:
import u = require('fr/domain/MyUtils');
import MyUtils = u.fr.domain.MyUtils;
After doing that you can write this in a module:
MyUtils.myStaticMethod();
It's cleaner but Eclipse TS plugin get completely lost with this and auto completion become erratic. In Visual Studio auto completion is OK but "F12 Go to definition" has to be done twice which is annoying.
Is there a better way to do this ? Or should we just keep namespaces as short as we can ?
You’re doing it wrong.
Your 'fr/domain/MyUtils' module should be exporting only whatever is supposed to be MyUtils. i.e. it should look like this:
export function myStaticMethod() { /* ...code... */ }
It should not be exporting some global namespace object, and it should not be adding anything to some global namespace object that you get from somewhere else. The natural placement of module files in directories is the way you create “namespaces” when you work with external modules.
If you do it correctly then your consumer looks like this:
import MyUtils = require('fr/domain/MyUtils');
MyUtils.myStaticMethod();
or, even more properly using ES module syntax:
import { myStaticMethod } from 'fr/domain/MyUtils';
myStaticMethod();
In an effort to adapt a company-wide header format to doxygen, I would like to create some custom tags that will be ignored by doxygen. I think I can do this with an alias, but so far have only been able to replace tags with others. What I am trying to accomplish:
/**
* #company Company Name
**/
with an alias like #company="". Unfortunately, this just prints the text with no section name.
Any ideas?
You could use HTML style comments to hide parts, i.e.
/** Show this <!-- but hide this --> and show this again */
Or you could use #if...#endif
/** Show this #if VISIBILE but hide this #endif and show this again */
To save typing you could define a pair of aliases
ALIASES = hide="#if VISIBLE" endhide="#endif"
and then write
/** Show this #hide but hide this #endhide and show this again */
I'm building a Sencha Touch mobile application and are using the functionality to create image-sprite-maps with Compass.
Is there any way to calculate the size of the image-map (width and height) and put it as a variable in your SCSS file?
In Compass, image-height and image-width are the functions to get image dimensions. Using them with your sprite map would look something like this (warning, untested):
// Assuming $my-sprites is your sprite map variable
$map-path: sprite-path($my-sprites);
$map-height: image-height($map-path);
$map-width: image-width($map-path);
In the latest version of Sass (3.4) sprite-path() returns the full filesystem path while image-width() expects a path relative to the images directory. But there is a simple solution:
sprite-width($sprite-map);
sprite-height($sprite-map);
You can get a unit value by using the magical dimension functions <map>-sprite-height and <map>-sprite-width.
// Note: "my-icons" represents the folder name that contains your sprites.
#import "my-icons/*.png";
$box-padding: 5px;
$height: my-icons-sprite-height(some_icon);
$width: my-icons-sprite-width(some_icon);
.somediv {
height:$height + $box-padding;
width:$width + $box-padding;
}
Check the official documentation for more details.
Ext.getBody().getSize() gets you height and width of the screen but i dont think you can write this in SASS
I've just installed Aptana 2.0, and I'm trying to get Code Assist for Codeigniter. I've never used an IDE before, always stick with my good ol' E-text (Windows version for TextMate). But in every screencast about CodeIgniter, people use Aptana and get benefits of it's awesome Code Assist.
So...any tips for setting it up??
Thanks
Aptana autocomplete feature for php's build-in function and custom functions in your project is working out of the box. Just type the part of function name, and then press Ctrl+Space. A list of functions will displayed, and if there are only 1 function with that name, the full function name will automatically written.
However, since CI load the library and model using $this->load() method, Aptana will not recognize the methods in the library and models. To make Aptana recognize library's and model's methods, add these comments:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* #author donny
* #property CI_Loader $load
* #property CI_Input $input
* #property CI_Output $output
* #property CI_Email $email
* #property CI_Form_validation $form_validation
* #property CI_URI $uri
* #property Firephp $firephp
* #property ADOConnection $adodb
* #property Content_model $content_model
*/
class Content extends MY_Controller {
function Content()
{
parent::MY_Controller();
//load model
$this->load->model('content_model');
//...
}
/**
*
* #return void
* #access public
*/
function index()
{
//...
}
}
In code snipped above, when I type $this->input-> then press Ctrl+Space, a list of methods from Input library will be displayed. The key to do this is the comment with this line:
* #property CI_Input $input
This will tell Aptana that in my controller, the $this->input-> is actually an object of the CI_Input class. You can do this for models too. Just write the actual class name, and the name inside the controller, and Aptana will recognize and use it, like this:
* #property Content_model $content_model
I use Aptana and I don't set much. I just set the tab into space with 2 space, install git plugins and jquery support, tweak the shortcut, add php templates that I always use, and I'm ready to go. I try to keep the change minimum, so when I had to use other computer with fresh installed Aptana, I don't have to do re-setting too much. Just do some mandator setting and I can use it right away.
I hope this simple trick work for you.
Here is one for autocomplete
http://forums.aptana.com/viewtopic.php?f=14&t=8519