Comments (20)
OK, I'll look into it. Since I am actually just calling out to py-codekitlang, I'll try to get it fixed there. I think I have seen the same thing.
from grunt-codekit.
(Deleted comment - I am an idiot ... ). A small textfile to test with would still be good though. Like foo.kit & foo.html.
from grunt-codekit.
From what I can see:
recipes.kit
<div class="list-view">
<!-- @import "recipes_list.html" -->
</div>
recipes_list.html
<ul class="recipe-items"></ul>
Codekit output:
<div class="list-view">
<ul class="recipe-items"></ul> </div>
grunt-codekit output:
<div class="list-view">
<ul class="recipe-items"></ul>
</div>
from grunt-codekit.
hmm ... so it looks like CodeKit is actually the one doing the "wrong" thing - altering the output by removing the newline that is in the file that imports the other template. @gjo that is maintaining the python code is actually making a branch for dealing with CodeKit quirks, so this might be a thing worth having in there ... I see a --enable-codekit-quirks-mode flag coming :-)
I will need to find the time to produce some more test cases though.
from grunt-codekit.
I looked for a formal description of the kit syntax but found none, so it's hard to say if it's really a bug. However, I agree that this CodeKit output is rather unexpected.
Anyway, missing (or additional) newline in HTML, in most cases, doesn't alter what is rendered to the screen. So it doesn't seem to be a huge problem.
from grunt-codekit.
The description is the implementation. Not so readable :)
But I just ran the inputs you gave, and the result was different from what you presented. It seems like the python compiler adds a newline, as you noted, but I guess the inputs might differ from yours due to copy-pasting.
Codekit output
<div class="list-view">
<ul class="recipe-items"></ul>
</div>
Pykitlangc output (underlying Grunt)
<div class="list-view">
<ul class="recipe-items"></ul>
</div>
from grunt-codekit.
This is way overdue, but ... any chance you could just send me those input and output files? Copy-paste seems to introduce additional newline entities.
from grunt-codekit.
@fatso83 It looks to me like your editor is adding a blank line at the end of file.
@kdzwinel Is this still an issue after the change to node-kit? (grunt-codekit v.0.3 I believe).
from grunt-codekit.
@jeremyworboys: I need to update from version 0.3 of node-kit, but it seems this (or a related problem) is at least present in version 0.3. See #9. We are not producing the same output as CodeKit - probably needs to remove one newline per Kit deceleration. My Mac (and CodeKit) is at work, so I can't verify that this is what is actually happening until Monday
from grunt-codekit.
That should have been "per Kit declaration".
(Damn you, autocorrect!)
from grunt-codekit.
No worries. I have a CodeKit license, so I'll run some tests and see if I can get matching output.
from grunt-codekit.
You sure respond quickly to these; I barely get to type my comments before a new version is is in the NPM repo :-)
from grunt-codekit.
Okay, so I just deleted all my results files then ran the fixture source files through CodeKit 2.0.6. Git did not detect any changes to the files.
from grunt-codekit.
I have asked @sroberson to come up with an example of a file where CodeKit produces different output, but we are well into Saturday so it could probably lie for a day or two. It's not like this is breaking anything.
from grunt-codekit.
OK, here's the files. I've left the actual client text in there, which probably not the greatest idea, but the pages won't load anyway because of the javascript errors. But you'll be able to see the html output files which have [filename]-code-kit.html vs [filename]-node-kit.html.
http://dropsend.theprimacy.com/dl/a1ef3d8b-635c-4ac7-8d5c-e874007f56a3
Thanks.
from grunt-codekit.
I looked into the tests for node-kit- particularly the test for page.kit.
This is a strange test that a source file (https://github.com/jeremyworboys/node-kit/blob/master/test/fixtures/page.kit) that contains no empty line breaks is compared to a results file (https://github.com/jeremyworboys/node-kit/blob/master/test/fixtures/results/page.html) that has 2 leading line breaks.
from grunt-codekit.
I don't find that so strange, actually. It just shows that variable declarations count as lines. The two variable that are declared correspond exactly to the empty lines in the output. What follows is the master template that is filled with the variables.
As mentioned already, Jeremy ran all the kit files through CodeKit and it produced the exact same output (no diff in git), so this seems to be the correct interpretation of how it should be done.
from grunt-codekit.
BTW, I see from your zip-file that the output does differ in exactly this regard, so this needs some looking into. Thanks!
from grunt-codekit.
I attempted a fix for the whitespace issue. My approach was to discard the a single newline if it is the next character directly after a special comment. This worked well for most cases, but did not handle certain situations such as:
Input:
<!-- @var1=value1 -->
<!-- $var2=value2 -->
<!-- $var1 -->
<!-- @var2 -->
Expected output:
value1
value2
Actual output:
value1value2
Edit: Just thinking on this some more. I could only discard the first newline if it is the next character after an assignment or import directive. This would mean added complexity to the compilation stage, but should be simple enough. Thoughts?
Edit 2: Nevermind. Version 0.5 strips newlines directly following import and assignment directives.
from grunt-codekit.
@sroberson Sorry for taking so long to fix this. I simply forgot to push a new release after the new node-kit
version. A new version 0.4 is out now.
from grunt-codekit.
Related Issues (14)
- Counter-intuitive configuration HOT 2
- Unable to launch in a watch task HOT 4
- Task freezes HOT 3
- Feature Request: not require listing of each .kit file HOT 6
- Glob pattern working with 0.5.2 breaks in 1.0.0-beta HOT 6
- Support for @codekit-prepend/append HOT 3
- Any way to use Babel and ES6? HOT 2
- npm install fails on windows HOT 8
- Remove the python dependency HOT 1
- Variables from Imported Files HOT 12
- Update to node-kit 0.3.0 HOT 1
- Meta tags containing variable content aren't getting closed properly HOT 4
- HTML file has a lot of white space at top HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-codekit.