Comments (7)
@mootari Thanks for the issue! If you're reporting a bug, please be sure to include:
- The version of
assemble
you are using. - Your assemblefile.js (This can be in a gist)
- The commandline output. (Screenshot or gist is fine)
- What you expected to happen instead.
from assemble-loader.
The check here might make more sense. If .contents
exists, then .content
should exist as well since the properties are synced. If .contents
does not exist, then it seems like we wouldn't want to check for .content
, since the existence of only one of those properties indicates it's not a valid View
. thoughts? @doowb?
Some of this logic was done as we were still building the API and learning about what we were creating. Thanks for creating issues, it's much appreciated.
from assemble-loader.
Not sure if this is relevant, but utils.normalizeContent() in load-templates
checks for both content
and contents
:
https://github.com/jonschlinkert/load-templates/blob/995ccaf1955652ad3401d8457f331917b308b110/utils.js#L36-L47
from assemble-loader.
This specific isView
method is only used in this library to determine if a passed in object looks like a view
or an options
object. Another piece of code handles normalizing and "syncing" the content
and contents
properties later so I think that we should add a check for .content
in this specific method.
@mootari if you'd like to do a PR to update this piece of code, that would be awesome! I think you pointed out in another issue that some of these use hasOwnProperty
and some don't. I think this should be updated to either using .hasOwnProperty
or typeof obj.property === 'undefined'
.
Also, if you have ideas on consolidating the places where this code is duplicated into a single module that can be reused that would be great! Thanks for getting into the code and opening these issues, it really helps.
from assemble-loader.
think this should be updated to either using .hasOwnProperty or typeof obj.property === 'undefined'.
We don't want to use typeof obj.property === 'undefined'
since it's possible for a property to be defined with an undefined
value. I believe .contents
and .content
are both enumerable so .hasOwnProperty()
should be find. Otherwise we should use !(key in view)
.
from assemble-loader.
I did a quick search through assemble's dependencies. The following places call .isView():
Line 132 in 6d6b001
- https://github.com/jonschlinkert/load-templates/blob/995ccaf1955652ad3401d8457f331917b308b110/index.js#L60
- https://github.com/jonschlinkert/load-templates/blob/995ccaf1955652ad3401d8457f331917b308b110/index.js#L69
- https://github.com/jonschlinkert/load-templates/blob/995ccaf1955652ad3401d8457f331917b308b110/index.js#L180
- https://github.com/jonschlinkert/load-templates/blob/995ccaf1955652ad3401d8457f331917b308b110/index.js#L198
- https://github.com/jonschlinkert/templates/blob/f030d2c2906ea9a703868f83574151badb427573/lib/views.js#L259
from assemble-loader.
- Looks like overloading for the options param, but the intention is not clear to me.
- For an array of templates, used to delegate each to either .addView() and .load()
- Again, looks like overloading for the options param (gate to either .addView() or .globViews())
- Overloads for the options param.
- Initializes path and key prior to passing off to .addView()
- Optional view argument, not clear where/when used.
from assemble-loader.
Related Issues (1)
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 assemble-loader.