Nette and Grunt task grunt-usemin for min. css and js files

5 years ago

chemix
Gold Partner | 987
+
+1
-

Hi, i update my example repository https://github.com/…/Nette-Grunt where is basic config for combine Nette and Grunt.

I'm using these blocks in @layout.latte template:

<!-- build:js {$basePath}/js/app.min.js -->
<script src="{$basePath}/js/netteForms.js"></script>
<script src="{$basePath}/js/helpers.js"></script>
<script src="{$basePath}/js/lightbox.js"></script>
<!-- endbuild -->

for automated building minified js and css with Grunt

5 years ago

srigi
Member | 558
+
0
-

Well, how did you manage usemin-ing of HTML with {$basePath} in front of path? grunt-usemin is not updating this script tags, cos it is unable to find file with that name on the disk.

Recently I also finished boilerplate of Nette & Grunt integration. I solved lots of things there including the above one (by forking usemin). Unfortunately it is not OSS yet (will be probably), but if you ask I can share important pieces.

5 years ago

chemix
Gold Partner | 987
+
0
-

i wrote little npm module grunt-nette-basepath that solve problem with {$basePath} string in paths https://github.com/…tte-basepath

5 years ago

David Grudl
Nette Core | 6864
+
0
-

Great! Whould you like to write a short article on nette blog?

5 years ago

chemix
Gold Partner | 987
+
0
-

This is ENGLISH/CZECH draft, is it ok?

https://docs.google.com/…RNt8SLM/edit?…

comments are welcome…

Last edited by chemix (2014-03-26 11:29)

5 years ago

Patrik Votoček
Member | 2249
+
0
-

<OT>Just question. Why do you write this short post about czech “article” on english forum?</OT>

5 years ago

chemix
Gold Partner | 987
+
0
-

Sorry for that, but it's quick reaction to David's question. I will write en version soon.

5 years ago

o5
Member | 417
+
0
-

I just want to suggest a great task called grunt-watch. It should be added to your grunt/nette skeleton for others, who don't know it. I discovered development with grunt-watch + livereload a few weeks ago and now I don't want to change :)

5 years ago

chemix
Gold Partner | 987
+
0
-

done, ENGLISH draft is ready for corrections and suggestions

https://docs.google.com/…RNt8SLM/edit?…

5 years ago

chemix
Gold Partner | 987
+
0
-

o5:
More tips how to live better life with grunt maybe will come ;-)

5 years ago

Quinix
Member | 108
+
0
-

Thank you for the tutorial, it worked like a charm :-)

But I have one problem… is there some way, how to replace relative paths to images etc. in minified css files?

5 years ago

Patrik Votoček
Member | 2249
+
0
-

Please send Pull Req. to https://github.com/…ette.org/pla

5 years ago

chemix
Gold Partner | 987
+
0
-

PV: sended (https://github.com/…docs/pull/94)

Q: i used the same (and one) folder for all css files like for minified version and i don't have this problem. But if you need something special try add other plugin http://gruntjs.com/plugins for example: https://www.npmjs.org/…-url-replace maybe solve your problem or use data-uri https://www.npmjs.org/…unt-data-uri

this article is only for start :) i'm using too more plugins

5 years ago

chemix
Gold Partner | 987
+
+1
-