jsoverson / preprocess

Preprocess HTML, JavaScript, and other files with directives based off custom or ENV configuration
Other
366 stars 80 forks source link

Question: What is the static_path function, and where/how is it defined? #57

Closed jonesnc closed 9 years ago

jonesnc commented 9 years ago

In the README, a function called static_path is called like this:

<script src="<!-- @exec static_path('another/production/javascript.js') -->"></script>

Could you provide some more information on what this function does and how it's defined?

BendingBender commented 9 years ago

When you execute the the preprocess function, you give it a context. This context is an object containing your variables and it may contain functions. So in the example above a function named static_path is called that was passed via the context object. You can see an example of this happening in preprocess_test.js. Here a function named hello is passed via context object.

Can I close the issue?

jonesnc commented 9 years ago

Can I close the issue?

Yes.

Thanks for enlightening me.