Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 21:32
    greenkeeper[bot] commented #5421
  • 21:32

    greenkeeper[bot] on can-stache-bindings-5.0.3

    fix(package): update can-stache… (compare)

  • 20:13
    phillipskevin synchronize #5421
  • 20:13

    phillipskevin on can-stache-bindings-5.0.2

    updating can-stache-bindings to… (compare)

  • 18:52
    cherifGsoul review_requested #5430
  • 18:47
    cherifGsoul edited #5430
  • 18:46
    cherifGsoul synchronize #5430
  • 18:46

    cherifGsoul on update-infrastructure-page

    Remove can-util and other stuff (compare)

  • 18:09
    jonathanzuniga starred canjs/canjs
  • 17:32
    mateus007 starred canjs/canjs
  • 16:12
    gregmartin06 starred canjs/canjs
  • 11:45
    alex-zhang starred canjs/canjs
  • Nov 21 19:51
    greenkeeper[bot] commented #5392
  • Nov 21 19:51

    greenkeeper[bot] on core-js-3.4.2

    chore(package): update core-js … (compare)

  • Nov 20 19:48

    phillipskevin on master

    Update dist for release (compare)

  • Nov 20 19:48

    phillipskevin on v6.2.7

    Update dist for release 6.2.7 (compare)

  • Nov 20 19:30

    phillipskevin on six-two-seven

    (compare)

  • Nov 20 19:30
    phillipskevin closed #5431
  • Nov 20 19:19
    phillipskevin synchronize #5431
Vojtech Prikryl
@Aldredcz
@matthewp
Marshall Thompson
@marshallswain
@Aldredcz It's Gulp, so you can just use code. Here's an example gulpfile.js. Just change the path names to fit what you want.
var gulp = require('gulp'),
  compilerGulp = require('can-compile/gulp.js'),
  stealTools = require('steal-tools');

// Steal Build / Watch the App
gulp.task('steal-build', function() {
  stealTools.build({
    main: 'main',
    bundlesPath: '../assets',
    config: 'public/main/stealconfig.js'
  });
});
gulp.watch('public/main/**/*.*', ['steal-build']);

// Build / Watch CanJS TEMPLATES
var options = {
  src: ['public/**/*.stache'],
  out: 'public/assets/main.stache.js',
  version: '2.1.3'
};
compilerGulp.task('main-views', options, gulp);
compilerGulp.watch('main-views', options, gulp);


// The default task (called when you run `gulp` from cli)
gulp.task('default', [
  'steal-build',
  'main-views',
  'main-views-watch',
]);
Vojtech Prikryl
@Aldredcz
@matthewp thanks
wrong highlight, i meant thanks @marshallswain
Marshall Thompson
@marshallswain
You're welcome. The watch mode works quite well this way, but it will be built into Steal in the not-too-distant future.
*from what I've read.
Matthew Phillips
@matthewp
Yep, next is full source maps
Watch mode will be after that
And we're going to have even better gulp support in the future as well
@marshallswain not using Steal for views?
Matthew Phillips
@matthewp
Maybe you're using Can 2.1 @marshallswain ?
Vojtech Prikryl
@Aldredcz
Hello, I have a Component with helper being live-bound to scope attributes, and event catching same attributes and modifying them (before this modification, the scope state is in invalid state)... but the helper got resolved before the event,.. can I somehow prioritize the event callback, so the helper work with valid state?
Matthew Phillips
@matthewp
hm, not sure i understand what you mean
Vojtech Prikryl
@Aldredcz
inputType: function (subRule, options) {
                subRule = (typeof subRule === 'function') ? subRule() : subRule;

                var disabled = !subRule.attr('operator') || !subRule.attr('subject'),
                    multiple = disabled ? false : this.operatorsHash[subRule.attr('operator')].usage === 'STRING_LIST',
                    type;

                if (!this.predefinedValuesHash[subRule.attr('subject')] && multiple) {
                    type = 'tags';
                }
                else if (this.predefinedValuesHash[subRule.attr('subject')]) {
                    type = 'select';
                }
                else {
                    type = 'input';
                }

                return options.fn(options.scope.add({subRule: subRule, type: type, multiple: multiple, disabled: disabled}));
            }
{{#inputType .}}
                        {{#equals type 'input'}}
                            <input type="text" class="form-control" can-value="{subRule.value}" {{#if disabled}}disabled{{/if}}>
                        {{/equals}}
                        {{#equals type 'tags'}}
                            <div>
                                <input type="hidden" class="form-control" {{data 'input'}} {{initTags}}>
                            </div>
                        {{/equals}}
                        {{#equals type 'select'}}
                            <div>
                                <input type="hidden" class="form-control" {{data 'input'}} {{initSelect}}>
                            </div>
                            {{type}}, {{#if multiple}}multiple{{else}}single{{/if}}
                        {{/equals}}
                    {{/inputType}}
then I have events listening to changes in subRule.operator and subRule.subject, according to them, it modifies other attributes of subRule. And according to that, initTags and initSelect is rendered,.. but those helpers are called before event callbacks
Vojtech Prikryl
@Aldredcz
already solved it ... had operator and subject bound by can-value on <select>, so changed it to can-change and handled all the changes in can.batch, so I'm always in valid state... but once I would need to react to changes from other controller and not from view,.. dunno how I would solve it..
Marshall Thompson
@marshallswain
@matthewp Yes, still using 2.1.4, so can-compile’ing the views for a few more days.
Vojtech Prikryl
@Aldredcz

Was just diggin in lib files, this is in view/scanner.js:

// Escapes characters starting with `\`.
        clean = function (content) {
            return content
                .split('\\')
                .join("\\\\")
                .split("\n")
                .join("\\n")
                .split('"')
                .join('\\"')
                .split("\t")
                .join("\\t");
        },

You sure that's the best way how to escape chars in terms of performance?

Matthew Phillips
@matthewp
where is that?
oh, view/scanner
probably not the best way
i wonder how often this function gets called
but you're right
PRs welcome :)
Justin Meyer
@justinbmeyer
@Aldredcz you should really switch to stache
@Aldredcz you can check ev.batchNum
var lastBatchNum
bind("EVENT", function(ev){
  if(ev.batchNum === undefined || ev.batchNum !== lastBatchNum) { 
    lastBatchNum = ev.batchNum

    DO STUFF
 }
Vojtech Prikryl
@Aldredcz
@justinbmeyer Yea, slowly migrating whole app from ejs to stache,..
about batchNum - I know it and use it a lot, but this is not the case,.. I was asking if i can control somehow order of events 'helper live bound update' and 'event live bound update' in Component
Justin Love
@JustinLove
An inner component changes the state of the server. What is a good way to tell the parent components to refresh their data?
Matthew Phillips
@matthewp
@JustinLove There's currently some work to be done to make this better
I think for now you might need to do
this.element.parent().scope().refreshData()
or something likethat
Justin Love
@JustinLove
Thanks. I ended up firing an event; I had trouble with that at first because foundation dialogs get moved to body, which changed the bubbling chain.
Can I make can.view do #id lookup only, without a web request if isn't found?
Justin Love
@JustinLove
Are there complex examples of can.route?
Justin Meyer
@justinbmeyer
@JustinLove https://github.com/bitovi/steal-can-example/blob/master/main.js is a small but complex example
what kind of example are you looking for?
Justin Meyer
@justinbmeyer
If you were using the #minor branch, it had everything in a "lib" folder. That is now gone in master. So if you were using that structure, you will need to change your paths configuration to point to the new location.
Justin Meyer
@justinbmeyer
@alexisabril regarding your pushstate question ...
do you need to return the data?
sorry, the html
Alexis Abril
@alexisabril
nope
just looking to ignore /foo/bar/baz from the node side
Justin Meyer
@justinbmeyer
Ok, so you just need to handle all incoming urls
Alexis Abril
@alexisabril
not really canjs specific
Justin Meyer
@justinbmeyer
oh, but not sure how to do it?
Alexis Abril
@alexisabril
yep, totally lazyweb
app.use('/', serveStatic(__dirname))
.use(function(req, res) {});
Justin Meyer
@justinbmeyer
what framework?