CVS edit link for bachbach

hy

i was writing this module to improve the time i am spending to theme the websites i build all day.
i read entirely the Apply for contributions CVS access page, and i wont write a novel here, it is just about daily work and sharing it.

the description of my module project

automaticly load css and js files from css and script folders into the current template if they exists and use page-[scheme].tpl.php. shemes are based on divers sites informations like url alias, nid, and more.

using drupal_add_css($f, "theme", "screen", true); and drupal_add_js($f, "theme"); functions on autofiles_preprocess_page() hook

like node-contenttype.tpl.php systeme, autofiles look for files schemes based on :

q : ex style-node.css, style-node-28.css, script-taxonomy.js, etc

url alias : using drupal_get_path_alias($_GET['q']) depending on path module
ex style-my-current-pass.css or/and script-my-current.js for my/current/pass

for css files look for two type of css files screen and print
ex : style-node.css and style-node-print.css
drupal_add_css($f, "theme", "screen", true);
drupal_add_css($f, "theme", "print", true);

schemes for front
Array
(
[0] => Array
(
[0] => front
)

)
search for : style-front.css, style-front-print.css, script-front.js, page-front.tpl.php

for a blog content type node whith "ouvertures/how-draw-cristals" alias
Array
(
[0] => Array
(
[0] => node
[1] => node-blog
[2] => node-nid-50
[3] => node-uid-3
)

[1] => Array
(
[0] => 2-args
[1] => *
[2] => ouvertures
)

[2] => Array
(
[0] => *-*
[1] => *-how-draw-cristals
[2] => ouvertures-*
[3] => ouvertures-how-draw-cristals
)

)
look for files look likes all this schemes apply to style-[sheme].css, style-[sheme]-print.css, script-[sheme].js, page-[scheme].js

ALL files founded are loaded in order of precedent array

In the future :
add language support : style-fr-[scheme].css
add settings in drupal theme settings pages like activation by theme, selection of scheme type, selection of file type js and/or css (screen and/or print)
create automaticly scripts and styles folder on theme folders who use autofiles

CommentFileSizeAuthor
#1 autofiles.zip2.7 KBbachbach

Comments

bachbach’s picture

StatusFileSize
new2.7 KB

here is my module

bachbach’s picture

Status: Postponed (maintainer needs more info) » Needs review
bachbach’s picture

ok, i find some mistakes in my description, here is a better version
my apologies for my english
best regards

the description of my module project

automaticly load css and js files from"styles" and "scripts" folders into the current template if they exist, using drupal_add_css($f, "theme", "screen", true); and drupal_add_js($f, "theme"); functions on autofiles_preprocess_page() hook, autofiles either add more template suggestions for tpl.php files than core do.

Schemes are based on divers sites informations like url alias, nid, and more, for example :

q : node/28
-> style-node.css, style-node-28.css.

url alias : my/current/path
-> style-my-current-path.css or/and script-my-current-path.js and/or page-my-current-path.tpl.php
using drupal_get_path_alias($_GET['q']) depending on path module

for css files looks for two types of css files : screen and print
-> style-node.css and style-node-print.css
drupal_add_css($f, "theme", "screen", true);
drupal_add_css($f, "theme", "print", true);

scheme for front, only one

Array
  (
  [0] => Array
    (
    [0] => front
    )
)

-> search for : style-front.css, style-front-print.css, script-front.js, page-front.tpl.php

for a blog content type node whith "ouvertures/how-draw-cristals" alias

Array
  (
  [0] => Array
  (
    [0] => node
    [1] => node-blog
    [2] => node-nid-50
    [3] => node-uid-3
  )

  [1] => Array
  (
    [0] => 2-args
    [1] => *
    [2] => ouvertures
  )

  [2] => Array
  (
    [0] => *-*
    [1] => *-how-draw-cristals
    [2] => ouvertures-*
    [3] => ouvertures-how-draw-cristals
  )
)

-> search for files look likes all this schemes : style-[sheme].css, style-[sheme]-print.css, script-[sheme].js, page-[scheme].js
files founded are loaded in order of precedent array

In the future :
add language support : style-fr-[scheme].css, etc
add taxonomy support : style-tid-4.css, style-vid-10.css, style-vid-10-tid-4.css
add settings in drupal theme settings pages like activation by theme, selection of schemes types, selection of file type js and/or css (screen and/or print)
create automaticly scripts and styles folder on theme folders who use autofiles

thanks to read me again

avpaderno’s picture

Status: Needs review » Needs work

There are two modules that together have a similar purpose of the proposed module: http://drupal.org/project/css_injector, and http://drupal.org/project/js_injector; there is also another module that have a similar purpose (I don't find its project page, at the moment).

bachbach’s picture

Status: Needs work » Needs review

i know these two modules, but the purpose of mine is different, i try to add a new dimension to theming.
It 'injecting' automaticly all availables js and css files in the current site theme, you don't have to configure each files and you stay in your editor to build your theme, this is more friendly to work than a textfield.
i don't know the third module.

avpaderno’s picture

What changes is where the CSS styles or the JavaScript code are taken, but the purpose is to allow to inject CSS styles or JavaScript code.

bachbach’s picture

don't you think these points make some differents :

1 - the injection is automatic, no need to configuration, it's gain of themer's time

2 - the injection is part of each thems, you change the theme, the files are not injected, with the two others modules you have to return to the configuration and discard them

3 - with one essential css file associate to specifics css files by page syteme, instead of one big ccs file for all the site, specialy for complexe themes with many differents design page, we can decrease the weight of loaded files

4 - the diversity of composing
with this one path you can potentialy automaticaly add all these files to your theme :
http://domaine.org/ouvertures/how-draw-cristals

style-node.css (with all node)
style-node-blog.css (with all nodes of 'blog' type)
style-node-nid-50.css (with one nodes by id)
style-node-uid-3.css (with all nodes by one user)

style-*.css (only one argument in the alias)
style-ouvertures.css (only the first argument of the alias and no second)

style-*-*.css (two args in the alias)
style-*-how-draw-cristals.css (anything in the first argument of the alias and 'how-draw-cristals' in the second)
style-ouvertures-*.css (the first argument of alias with necessarily a second )
style-ouvertures-how-draw-cristals.css (all the alias)

and you don't have to do anything more than create the file(s) in your theme
and we can improve so much the systeme

i am not an engineer, i am a designer, may my code not be clean, in this case tell me what is wrong and i will work on it
or have you got some propositions to improve this module

avpaderno’s picture

The features you report can be added to the existing project(s). It's stated on the requirements page that the proposed module must not duplicate the work done in another project; in this case the difference between the projects doesn't justify the creation of another module with the same purpose.

bachbach’s picture

ok here it is the third module customcssjs.

ok i have contacted the css_injector and customcssjs modules maintainers.

#669106: Merge custom css and js module with css injector

avpaderno’s picture

Status: Needs review » Needs work

I am changing status as per previous comment.

avpaderno’s picture

Status: Needs work » Closed (won't fix)

There have not been replies in the last week. I am marking this application as won't fix.