1

I'm not really a fan of gulp but is it possible for gulp to do very similar to django compressor? Something like this in the HTML files:

{% compress js %}
<script type="text/javascript" src="one.js"></script>
<script type="text/javascript" src="two.js"></script>
<script type="text/javascript" src="three.js"></script>
<script type="text/javascript" src="four.js"></script>
<script type="text/javascript" src="five.js"></script>
{% endcompress %}

{% compress csss %}
<link rel="stylesheet" href="one.css">
<link rel="stylesheet" href="two.css">
<link rel="stylesheet" href="three.css">
<link rel="stylesheet" href="four.css">
<link rel="stylesheet" href="five.css">
{% endcompress %}

The code above will automatically create a minified and concatenated cached file within the tags every page reload

I'm aware that gulp is good in concatenation and minification but as I see(by reading the documentation) you still need to manually code it or add the files in the gulpfile.js all through out.

Or is there any other front-end tools that can be used to achieve this?

PS

I'm searching a compressor for my 'front-end only' app

Dean Christian Armada
  • 6,724
  • 9
  • 67
  • 116
  • Gulp and Grunt are basically the code-generated-configuration/configuration based tools. Ultimately, some one has to tell, where to look for JS/CSS files to get it compressed. There are regex used for searching all JS/CSS files and compressing it. Yet, with django-compressor, it uses django as a base to update the same. Look into further [asset-managers-for-django-choose-which-one](http://stackoverflow.com/questions/1684062/asset-managers-for-django-choose-which-one) – Nagaraj Tantri Jun 07 '16 at 02:15
  • I'm searching a compressor for my 'front-end only' app – Dean Christian Armada Jun 07 '16 at 02:16
  • Then you can give a look for [grunt](http://gruntjs.com/configuring-tasks) which is like configure and run to do all the compression tasks. – Nagaraj Tantri Jun 07 '16 at 02:19
  • Will the process of that compression tasks be similar to django compressor? Where all files are just needed to be inside the tags and it will automatically create a new file? – Dean Christian Armada Jun 07 '16 at 02:20
  • 1
    Nope, it cant do that, when you specify front-end-only, it would not be as simple as add some tags to html. Because, django compressor uses underlying django configuration (settings.py) to process and update. Where as tools like grunt/gulp would not know anything of python/django, so someone has to tell the npm packages like grun/gulp to, scan from where and output what. :) – Nagaraj Tantri Jun 07 '16 at 02:23
  • Great explanation! I figured as well, just testing my luck. So seems like you are very familiar. What do you prefer? Grunt or Gulp? – Dean Christian Armada Jun 07 '16 at 02:26
  • 1
    Personally I prefer Grunt. It's just configuration and running tasks to do what I want. :) – Nagaraj Tantri Jun 07 '16 at 02:43

0 Answers0