kamlekar / HTML-Skinning-Boilerplate

A Boilerplate/Scaffold to do HTML skinning faster for Websites.
15 stars 6 forks source link

Need to add new variable for relative paths #29

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi, I think it will be useful to add new variable "path" to existing "css_path", "js_path", "img_path". So we can easily set relativeness of our folders. Explanation: I have such project strucure:

project/
|  sass/
|  site/
|  templates-pre/
|  |  shop/
|  |  |  shop.html
|  index.html

In compiled site/shop/shop.html I have the same css/img/js paths as in site/index.html because css_path is unchangeable and set one time).

But if I have new path variable I set skeleton css/js/img paths that way:


<link href="{{path}}{{css_path}}main.css" />
<script src="{{path}}{{css_path}}scripts.js" />

And in templates-pre/shop/shop.html I set path variable to relative path:

{% set path="../" %}

So in site/shop/shop.html I have my relative paths:


<link href="../assets/css/main.css" />
<script src="../assets/js/scripts.js" />

That works fine for me. Sorry I have no time to go deeper for github but I can only sketch my suggestions that way.

kamlekar commented 8 years ago

Sorry I have no time to go deeper for github but I can only sketch my suggestions that way.

@rustemgareev yeah no problem.

Lets keep the values hardcoded as they are now. It is clear that if user wants (as you are), he/she will modify as necessary.

Let the users customize as they want. Our main goal here is to bundle all the necessary plugins required before starting HTML Development.

kamlekar commented 8 years ago

hmm.. but currently there are no html files which are compiling in a folder. I am keeping all the compiling files as immediate children to templates-pre folder. Even if I consider to add {% set path="../" %}, I can't add anywhere in the current structure of boilerplate because all the indirectly compiling files present in folders (prefixed as _) which will eventually compiled to immediate child files of site folder.

ghost commented 8 years ago

Sorry I can't get last sentence.

ghost commented 8 years ago

By the way that's improved code for what I want get:


/* skeleton-content.html */
{% set css_path = path+css_path %}
{% set js_path = path+js_path %}
{% set img_path = path+img_path %}
<html>
...
<link href="{{ css_path }}" />
...
<img src="{{ img_path }}" />
...
<script src="{{ js_path }}" />
...


/* gulpfile.js */
...
css_path: assetsPath.css;
js_path: assetsPath.js;
img_path: assetsPath.img;
path: '';
...


/* And if we have templates-pre/inner-folder/inner-index.html */
{% set path="../" %}

kamlekar commented 8 years ago

What I am trying to say is there is no templates-pre/inner-folder/inner-index.html structure in this Boilerplate currently. In inner-folders I have only components and variables. After compiling, the files will be compiled to site/index.html or site/index2.html but not site/some_folder/inner-index.html.

ghost commented 8 years ago

But predict that user may have complex structure, and instead of opening issue and asking you how to set relative paths for assets ("../" or "../../") you will already have solution! :)

kamlekar commented 8 years ago

No the thing is I am unable to understand in which file exactly I should keep this variable?

ghost commented 8 years ago

Look at my previous comment starting with By the way that's improved code for what I want get: They are defined first in gulpfile.js, then in skeleton-content.html and then in every .html file in nested folders. (site/inner-folder/index.html for example)

kamlekar commented 8 years ago

It is better that you suggest the changes with a pull request (to "pr-branch"). Clearly, I am unable to visualize exactly of how this will be useful. Please send a PR when you have time :)

kamlekar commented 8 years ago

@rustemgareev Hi, I hope you are not mad at me as you stopped contributing. The changes you are suggesting will assume the complexity of the directory structure. Let's leave that to the devs who will use this Boilerplate. As per there need, they will add variables as you are suggesting. If we add from now only, it will lead to confusing, IMO. Thanks for your contributions.

ghost commented 8 years ago

Hi, I can't contribute just only because of no time, so if I only had it more, I would help. Yes, I agree that some suggestions are too complex, so if I will have ideas for simplifying, I'll try to bring them to you